Skip to content

API

Data Model

This section contains the core structure of data model, which includes all the variables used in the ATC survey.

Data Model for the SDIA Survey

AirPassenger

Bases: Respondent

Data model for an air passenger respondent. It includes attributes specific to air passengers.

Source code in data_model/data_model.py
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
class AirPassenger(Respondent):
    """
    Data model for an air passenger respondent. It includes attributes specific to air passengers.
    """

    resident_visitor_general: NoneOrNan[e.ResidentVisitorGeneral] = Field(
        ...,
        description="Whether a resident or a visitor of the San deigo airport service area",
    )
    """
    Whether a resident or a visitor of the San deigo airport service area.
    """

    resident_visitor_followup: NoneOrNanString[e.ResidentVisitorFollowup] = Field(
        ...,
        description="If neither a resident or a visitor, whether the respondent is visiting San Diego",
    )
    """
    If neither a resident or a visitor, whether the respondent is visiting San Diego.
    """

    resident_visitor_arriving: NoneOrNanString[bool] = Field(
        ..., description = "True if respondent lives outside San Diego Region and is going home by ground transportation"
    )

    """
    True if respondent lives outside San Diego Region and is going home by ground transportation
    """

    passenger_segment: NoneOrNan[e.PassengerSegment] = Field(
        ..., description="Segment of the air passenger: (Resident/Visitor and Arriving/Departing)"
    )
    """
    Segment of the air passenger: (Resident/Visitor and Arriving/Departing)
    """

    qualified_visitor: NoneOrNan[bool] = Field( 
        ..., description = "True if the respondent is a qualified visitor")
    """
    True if the respondent is a qualified visitor.
    """

    is_sdia_home_airport: NoneOrNan[bool] = Field(
        ..., description = "True if the respondent's home airport is SDIA"
    )
    """
    True if the respondent's home airport is SDIA
    """

    country_of_residence: NoneOrNan[e.Country] = Field(
        ...,
        description="Country of residence for international vistors",
    )
    """
    Country of residence for international vistors.
    """

    state_of_residence: NoneOrNan[e.State] = Field(
        ...,
        description="State of residence for US and Mexico residents",
    )
    """
    State of residence for US and Mexico residents.
    """

    passenger_type: NoneOrNanString[e.PassengerType] = Field(
        ..., description = "Type of Passenger: Arriving, Departing or Connecting"
    )
    """
    Type of Passenger: Arriving, Departing or Connecting
    """

    previous_or_next_airport: NoneOrNanString[str] = Field(
        ..., description = "Where is the respondent flying from/flying to"
    )
    """
    Where is the respondent flying from/flying to.
    """


    # @model_validator(mode="before")
    # def validate_airport(cls, values):
    #     # List of fields to validate
    #     fields_to_check = ['previous_or_next_airport']

    #     for field in fields_to_check:
    #         value = values.get(field)
    #         if not isinstance(value, str):
    #             values[field] = str(value)
    #             values['valid_record'] = False
    #             values['validation_severity'] = "Low"
    #             values['validation_error'] = f"{field} is not string"

    #     return values

    airline: NoneOrNanString[e.Airline] = Field(
        ..., description = "Airline of the respondent's flight"
    )
    """
    Airline of the respondent's flight.
    """

    airline_other: NoneOrNanString[str] = Field(
        ..., description = "Other (not listed) airline of the respondent's flight"
    )
    """
    Other (not listed) airline of the respondent's flight.
    """

    flight_number: NoneOrNanString[Union[str, int]] = Field(
        ..., description = "Flight number of the respondent's flight"
    )
    """
    Flight number of the respondent's flight.
    """

    is_direct_flight: NoneOrNanString[bool] =  Field(
        ..., description = "True if the passenger did not use/is not using any connecting flights in their journey"
    )
    """
    True if the passenger did not use/is not using any connecting flights in their journey
    """

    @computed_field(
        return_type = e.Terminal,
        description = "Airport Terminal for Air Passenger",
    )
    @property
    def airport_terminal(cls):
        """
        Airport Terminal for Air Passenger
        """
        if cls.interview_location == e.InterviewLocation.TERMINAL_1:
            return e.Terminal.TERMINAL_1
        if cls.interview_location == e.InterviewLocation.TERMINAL_2:
            return e.Terminal.TERMINAL_2

        #Deriving using Airline if location is not a terminal
        if cls.airline in range(1,14):
            return e.Terminal.TERMINAL_2
        elif cls.airline in [14,15,16,17]:
            return e.Terminal.TERMINAL_1
        else:
            return e.Terminal.UNKNOWN

    flight_purpose: NoneOrNanString[e.FlightPurpose] = Field(
        ..., description = "Purpose of the respondent's flight"
    )
    """
    Purpose of the respondent's flight.
    """

    flight_purpose_other: NoneOrNanString[str] = Field(
        ..., description = "Other (not listed) purpose of the respondent's flight"
    )
    """
    Other (not listed) purpose of the respondent's flight
    """


    # @computed_field(
    #     return_type = e.ResidentVisitorPurpose,
    #     description = "Determines the resident/visitor classification based on the home airport status and flight purpose",
    # )
    # @property
    # def resident_visitor_purpose(cls):
    #     """
    #     Determines the resident/visitor classification based on the home airport status and flight purpose.
    #     """
    #     if cls.is_sdia_home_airport == True and cls.flight_purpose in {e.FlightPurpose.BUSINESS_WORK, e.FlightPurpose.COMBINATION_BUSINESS_LEISURE}:
    #         return e.ResidentVisitorPurpose.RESIDENT_BUSINESS
    #     elif cls.is_sdia_home_airport == False:
    #         return e.ResidentVisitorPurpose.RESIDENT_NON_BUSINESS
    #     elif cls.flight_purpose in {e.FlightPurpose.BUSINESS_WORK, e.FlightPurpose.COMBINATION_BUSINESS_LEISURE}:
    #         return e.ResidentVisitorPurpose.VISITOR_BUSINESS
    #     else:
    #         return e.ResidentVisitorPurpose.VISITOR_NON_BUSINESS


    checked_bags: NoneOrNan[e.CheckedBags] = Field(
        ..., description = "Number of checked bags"
    )
    """
    Number of checked bags.
    """

    carryon_bags: NoneOrNan[e.CarryOns] = Field(
        ..., description = "Number of carry-on bags"
    )
    """
    Number of carry-on bags.
    """

    number_of_nights: NoneOrNan[e.TravelDuration] = Field(
        ..., description = "Number of nights the respondent will be visiting/away"
    )
    """
    Number of nights the respondent will be visiting/away
    """

    party_size_ground_access_same: NoneOrNanString[bool] = Field(
        ..., description = "Whether flying party all traveled to airport together"
    )
    """
    Whether flying party all traveled to airport together
    """

    party_size_ground_access: NoneOrNan[int] = Field(
        ..., description = "Size of ground access travel party"
    )
    """
    Size of ground access travel party
    """

    party_includes_child_aged00to05: NoneOrNanString[bool] = Field(
        ..., description = "True if the traveling party includes a child aged zero to two"
    )
    """
    True if the traveling party includes a child aged zero to two.
    """

    party_includes_child_aged06to17: NoneOrNanString[bool] = Field(
        ..., description = "True if the traveling party includes a child aged three to nine"
    )
    """
    True if the traveling party includes a child aged three to nine.
    """

    party_includes_coworker: NoneOrNanString[bool] = Field(
        ..., description = "True if the traveling party includes a coworker"
    )
    """
    True if the traveling party includes a coworker.
    """

    party_includes_friend_relative:  NoneOrNanString[bool] = Field(
        ..., description = "True if the traveling party includes a friend or relative"
    )
    """
    True if the traveling party includes a friend or relative.
    """

    party_includes_mobility_impaired:  NoneOrNanString[bool] = Field(
        ..., description = "True if the traveling party includes a mobility impaired person"
    )
    """
    True if the traveling party includes a mobility impaired person
    """

    party_composition_list: NoneOrNanString[str] = Field(
        ..., description = "List of people in the traveling party"
    )
    """
    List of people in the traveling party
    """

#Add here
    sdia_flight_frequency: NoneOrNan[e.SanFlightFrequency] = Field(
        ..., description = "Respondent's number of flights from SDIA in the past 12 months"
    )
    """
    Respondent's number of flights from SDIA in the past 12 months.
    """

    access_mode_frequency: NoneOrNan[e.SanFlightFrequency] = Field(
        ..., description = "Number of times respondent used revealed access modes for other SDIA airport access trips in the past 12 months"
    )
    """
    Number of times respondent used revealed access modes for other SDIA airport access trips in the past 12 months.
    """

#Distribution of all modes:
    sdia_accessmode_split_taxi: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used taxi as a mode for his trip to SDIA in the last 12 months")
    """
    True if the respondent used taxi as a mode for his trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_uber_lyft: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used Uber or Lyft as a mode for their trip to SDIA in the last 12 months")
    """
    True if the respondent used Uber or Lyft as a mode for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_car_black: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a black car or luxury service for their trip to SDIA in the last 12 months")
    """
    True if the respondent used a black car or luxury service for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_dropped_off_by_family_friend: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent was dropped off by a family member or friend for their trip to SDIA in the last 12 months")
    """
    True if the respondent was dropped off by a family member or friend for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_drove_alone_and_parked: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent drove alone and parked at SDIA in the last 12 months")
    """
    True if the respondent drove alone and parked at SDIA in the last 12 months
    """

    sdia_accessmode_split_drove_with_others_and_parked: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent drove with others and parked at SDIA in the last 12 months")
    """
    True if the respondent drove with others and parked at SDIA in the last 12 months
    """

    sdia_accessmode_split_rode_with_other_travelers_and_parked: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent rode with other travelers and parked at SDIA in the last 12 months")
    """
    True if the respondent rode with other travelers and parked at SDIA in the last 12 months
    """

    sdia_accessmode_split_mts992: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used MTS992 for their trip to SDIA in the last 12 months")
    """
    True if the respondent used MTS992 for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_flyer_shuttle: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used the Flyer Shuttle for their trip to SDIA in the last 12 months")
    """
    True if the respondent used the Flyer Shuttle for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_other_public_transit: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used another form of public transit for their trip to SDIA in the last 12 months")
    """
    True if the respondent used another form of public transit for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_rental_car_dropped_off: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a rental car and was dropped off at SDIA in the last 12 months")
    """
    True if the respondent used a rental car and was dropped off at SDIA in the last 12 months
    """

    sdia_accessmode_split_rental_car_parked: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent parked a rental car at SDIA in the last 12 months")
    """
    True if the respondent parked a rental car at SDIA in the last 12 months
    """

    sdia_accessmode_split_chartered_tour_bus: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a chartered tour bus for their trip to SDIA in the last 12 months")
    """
    True if the respondent used a chartered tour bus for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_hotel_shuttle_van: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a hotel shuttle van for their trip to SDIA in the last 12 months")
    """
    True if the respondent used a hotel shuttle van for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_employee_shuttle: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used an employee shuttle for their trip to SDIA in the last 12 months")
    """
    True if the respondent used an employee shuttle for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_other_shared_van: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used another type of shared van service for their trip to SDIA in the last 12 months")
    """
    True if the respondent used another type of shared van service for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_walk: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent walked to SDIA in the last 12 months")
    """
    True if the respondent walked to SDIA in the last 12 months
    """

    sdia_accessmode_split_wheelchair: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a wheelchair for their trip to SDIA in the last 12 months")
    """
    True if the respondent used a wheelchair for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_bicycle_electric_bikeshare: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used an electric bikeshare for their trip to SDIA in the last 12 months")
    """
    True if the respondent used an electric bikeshare for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_bicycle_non_electric_bikeshare: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a non-electric bikeshare for their trip to SDIA in the last 12 months")
    """
    True if the respondent used a non-electric bikeshare for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_bicycle_personal_electric_bicycle: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a personal electric bicycle for their trip to SDIA in the last 12 months")
    """
    True if the respondent used a personal electric bicycle for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_bicycle_personal_non_electric_bicycle: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a personal non-electric bicycle for their trip to SDIA in the last 12 months")
    """
    True if the respondent used a personal non-electric bicycle for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_e_scooter_shared: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a shared electric scooter for their trip to SDIA in the last 12 months")
    """
    True if the respondent used a shared electric scooter for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_e_scooter_personal: NoneOrNanString[bool] = Field(
        ..., description  = "True if the respondent used a personal electric scooter for their trip to SDIA in the last 12 months")
    """
    True if the respondent used a personal electric scooter for their trip to SDIA in the last 12 months
    """

    sdia_accessmode_split_other: NoneOrNanString[str] = Field(
        ..., description = "Other mode the respondent used for their trip to SDIA in the last 12 months"
    )
    """
    Other mode the respondent used for their trip to SDIA in the last 12 months.
    """

    sdia_accessmode_split_list: NoneOrNanString[str] = Field(
        ..., description = "List of modes used by the respondent for their trip to SDIA in the last 12 months"
    )
    """
    List of modes used by the respondent for their trip to SDIA in the last 12 months.
    """

    sdia_accessmode_decision: NoneOrNan[e.ModeDecision] = Field(
        ..., description = "Factor which affects mode choice, for respondents who do not always used the same mode"
    )
    """
    Factor which affects mode choice, for respondents who do not always used the same mode.
    """

    sdia_transit_awareness: NoneOrNanString[e.YesNoType] = Field(
        ..., description = "Whether respondent is aware that buses are serving SDIA"
    )
    """
    Whether respondent is aware that buses are serving SDIA
    """
#Reasons to not use transit
    reasons_no_transit_not_convenient: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because it is not convenient"
    )
    """
    True if the respondent did not use transit because it is not convenient.
    """

    reasons_no_transit_too_complicated: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because it too complicated"
    )
    """
    True if the respondent did not use transit because it is too complicated.
    """ 

    reasons_no_transit_dont_know_how: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because they don't know how"
    )
    """
    True if the respondent did not use transit because they don't know how.
    """

    reasons_no_transit_no_good_options: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because there are no good options"
    )
    """
    True if the respondent did not use transit because there are no good options
    """

    reasons_no_transit_not_flexible: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because it is not flexible"
    )
    """
    True if the respondent did not use transit because it is not flexible.
    """

    reasons_no_transit_not_reliable: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because it is not reliable"
    )
    """
    True if the respondent did not use transit because it is not reliable.
    """

    reasons_no_transit_not_safe: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because it is not safe"
    )
    """
    True if the respondent did not use transit because it is not safe.
    """

    reasons_no_transit_ride_too_long: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because it takes too long"
    )
    """
    True if the respondent did not use transit because it takes too long
    """

    reasons_no_transit_wait_too_long: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because the wait time is too long"
    )
    """
    True if the respondent did not use transit because the wait time is too long
    """

    reasons_no_transit_does_not_run_when_needed: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because of it's schedule"
    )
    """
    True if the respondent did not use transit because of it's schedule
    """

    reasons_no_transit_too_many_transfers: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because it requries too many transfers"
    )
    """
    True if the respondent did not use transit because it requires too many transfers
    """

    reasons_no_transit_stop_too_far: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because the stop is too far"
    )
    """
    True if the respondent did not use transit because the stop is too far
    """

    reasons_no_transit_not_economical: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because it is not economical"
    )
    """
    True if the respondent did not use transit because it is not economical
    """

    reasons_no_transit_dislike_crowded_trains_buses: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because they don't like crowded trains and buses"
    )
    """
    True if the respondent did not use transit because they don't like crowded trains and buses.
    """

    reasons_no_transit_too_much_walking_stairs: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because it involves too much walking and/or stairs"
    )
    """
    True if the respondent did not use transit because it too much walking and/or stairs
    """

    reasons_no_transit_dislike_public_transport: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because they don't like public transport"
    )
    """
    True if the respondent did not use transit because they don't like public transport
    """

    reasons_no_transit_dislike_public_transport_with_luggage: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because they don't like public transport with luggage"
    )
    """
    True if the respondent did not use transit because they don't like public transport with luggage
    """

    reasons_no_transit_prefer_other_mode: NoneOrNanString[bool] = Field(
        ..., description = "True if the respondent did not use transit because they prefer other modes(s)"
    )
    """
    True if the respondent did not use transit because they prefer other mode(s)
    """

    reasons_no_transit_other: NoneOrNanString[str] = Field(
        ..., description = "Other reason why the respondent did not use transit"
    )
    """
    Other reason why the respondent did not use transit.
    """ 

    reasons_no_transit_list: NoneOrNanString[str] = Field(
        ..., description = "List of reasons why the respondent did not use transit"
    )
    """
    List of reasons why the respondent did not use transit.
    """

    non_sdia_flight_frequency: NoneOrNan[e.OtherFlightAndTransitUseFrequency] = Field(
        ..., description = "Respondent's number of flights from airport other than SDIA in the past 12 months"
    )
    """
    Respondent's number of flights from airport other than SDIA in the past 12 months.
    """

    other_airport_accessmode: NoneOrNanString[e.TravelMode] =  Field(
        ..., description = "Travel mode used to access other airports"
    )
    """
    Travel mode used to access other airports
    """

    other_airport_accessmode_grouped: NoneOrNanString[e.TravelModeGrouped] =  Field(
        ..., description = "Grouped Travel mode used to access other airports"
    )
    """
    Grouped Travel mode used to access other airports
    """

    airport_access_transit_use_elsewhere: NoneOrNanString[e.OtherFlightAndTransitUseFrequency] = Field(
        ..., description = "Frequency of Transit use by respondent to access other airports"
    )
    """
    Frequency of Transit use by respondent to access other airports.
    """

    airportaccesstransitname: NoneOrNanString[str] = Field(
        ..., description = "Name of other airport accessed by transit"
    )
    """
    Name of other airport accessed by transit.
    """

    pass 

access_mode_frequency = Field(..., description='Number of times respondent used revealed access modes for other SDIA airport access trips in the past 12 months') class-attribute instance-attribute

Number of times respondent used revealed access modes for other SDIA airport access trips in the past 12 months.

airline = Field(..., description="Airline of the respondent's flight") class-attribute instance-attribute

Airline of the respondent’s flight.

airline_other = Field(..., description="Other (not listed) airline of the respondent's flight") class-attribute instance-attribute

Other (not listed) airline of the respondent’s flight.

airport_access_transit_use_elsewhere = Field(..., description='Frequency of Transit use by respondent to access other airports') class-attribute instance-attribute

Frequency of Transit use by respondent to access other airports.

airport_terminal property

Airport Terminal for Air Passenger

airportaccesstransitname = Field(..., description='Name of other airport accessed by transit') class-attribute instance-attribute

Name of other airport accessed by transit.

carryon_bags = Field(..., description='Number of carry-on bags') class-attribute instance-attribute

Number of carry-on bags.

checked_bags = Field(..., description='Number of checked bags') class-attribute instance-attribute

Number of checked bags.

country_of_residence = Field(..., description='Country of residence for international vistors') class-attribute instance-attribute

Country of residence for international vistors.

flight_number = Field(..., description="Flight number of the respondent's flight") class-attribute instance-attribute

Flight number of the respondent’s flight.

flight_purpose = Field(..., description="Purpose of the respondent's flight") class-attribute instance-attribute

Purpose of the respondent’s flight.

flight_purpose_other = Field(..., description="Other (not listed) purpose of the respondent's flight") class-attribute instance-attribute

Other (not listed) purpose of the respondent’s flight

is_direct_flight = Field(..., description='True if the passenger did not use/is not using any connecting flights in their journey') class-attribute instance-attribute

True if the passenger did not use/is not using any connecting flights in their journey

is_sdia_home_airport = Field(..., description="True if the respondent's home airport is SDIA") class-attribute instance-attribute

True if the respondent’s home airport is SDIA

non_sdia_flight_frequency = Field(..., description="Respondent's number of flights from airport other than SDIA in the past 12 months") class-attribute instance-attribute

Respondent’s number of flights from airport other than SDIA in the past 12 months.

number_of_nights = Field(..., description='Number of nights the respondent will be visiting/away') class-attribute instance-attribute

Number of nights the respondent will be visiting/away

other_airport_accessmode = Field(..., description='Travel mode used to access other airports') class-attribute instance-attribute

Travel mode used to access other airports

other_airport_accessmode_grouped = Field(..., description='Grouped Travel mode used to access other airports') class-attribute instance-attribute

Grouped Travel mode used to access other airports

party_composition_list = Field(..., description='List of people in the traveling party') class-attribute instance-attribute

List of people in the traveling party

party_includes_child_aged00to05 = Field(..., description='True if the traveling party includes a child aged zero to two') class-attribute instance-attribute

True if the traveling party includes a child aged zero to two.

party_includes_child_aged06to17 = Field(..., description='True if the traveling party includes a child aged three to nine') class-attribute instance-attribute

True if the traveling party includes a child aged three to nine.

party_includes_coworker = Field(..., description='True if the traveling party includes a coworker') class-attribute instance-attribute

True if the traveling party includes a coworker.

party_includes_friend_relative = Field(..., description='True if the traveling party includes a friend or relative') class-attribute instance-attribute

True if the traveling party includes a friend or relative.

party_includes_mobility_impaired = Field(..., description='True if the traveling party includes a mobility impaired person') class-attribute instance-attribute

True if the traveling party includes a mobility impaired person

party_size_ground_access = Field(..., description='Size of ground access travel party') class-attribute instance-attribute

Size of ground access travel party

party_size_ground_access_same = Field(..., description='Whether flying party all traveled to airport together') class-attribute instance-attribute

Whether flying party all traveled to airport together

passenger_segment = Field(..., description='Segment of the air passenger: (Resident/Visitor and Arriving/Departing)') class-attribute instance-attribute

Segment of the air passenger: (Resident/Visitor and Arriving/Departing)

passenger_type = Field(..., description='Type of Passenger: Arriving, Departing or Connecting') class-attribute instance-attribute

Type of Passenger: Arriving, Departing or Connecting

previous_or_next_airport = Field(..., description='Where is the respondent flying from/flying to') class-attribute instance-attribute

Where is the respondent flying from/flying to.

qualified_visitor = Field(..., description='True if the respondent is a qualified visitor') class-attribute instance-attribute

True if the respondent is a qualified visitor.

reasons_no_transit_dislike_crowded_trains_buses = Field(..., description="True if the respondent did not use transit because they don't like crowded trains and buses") class-attribute instance-attribute

True if the respondent did not use transit because they don’t like crowded trains and buses.

reasons_no_transit_dislike_public_transport = Field(..., description="True if the respondent did not use transit because they don't like public transport") class-attribute instance-attribute

True if the respondent did not use transit because they don’t like public transport

reasons_no_transit_dislike_public_transport_with_luggage = Field(..., description="True if the respondent did not use transit because they don't like public transport with luggage") class-attribute instance-attribute

True if the respondent did not use transit because they don’t like public transport with luggage

reasons_no_transit_does_not_run_when_needed = Field(..., description="True if the respondent did not use transit because of it's schedule") class-attribute instance-attribute

True if the respondent did not use transit because of it’s schedule

reasons_no_transit_dont_know_how = Field(..., description="True if the respondent did not use transit because they don't know how") class-attribute instance-attribute

True if the respondent did not use transit because they don’t know how.

reasons_no_transit_list = Field(..., description='List of reasons why the respondent did not use transit') class-attribute instance-attribute

List of reasons why the respondent did not use transit.

reasons_no_transit_no_good_options = Field(..., description='True if the respondent did not use transit because there are no good options') class-attribute instance-attribute

True if the respondent did not use transit because there are no good options

reasons_no_transit_not_convenient = Field(..., description='True if the respondent did not use transit because it is not convenient') class-attribute instance-attribute

True if the respondent did not use transit because it is not convenient.

reasons_no_transit_not_economical = Field(..., description='True if the respondent did not use transit because it is not economical') class-attribute instance-attribute

True if the respondent did not use transit because it is not economical

reasons_no_transit_not_flexible = Field(..., description='True if the respondent did not use transit because it is not flexible') class-attribute instance-attribute

True if the respondent did not use transit because it is not flexible.

reasons_no_transit_not_reliable = Field(..., description='True if the respondent did not use transit because it is not reliable') class-attribute instance-attribute

True if the respondent did not use transit because it is not reliable.

reasons_no_transit_not_safe = Field(..., description='True if the respondent did not use transit because it is not safe') class-attribute instance-attribute

True if the respondent did not use transit because it is not safe.

reasons_no_transit_other = Field(..., description='Other reason why the respondent did not use transit') class-attribute instance-attribute

Other reason why the respondent did not use transit.

reasons_no_transit_prefer_other_mode = Field(..., description='True if the respondent did not use transit because they prefer other modes(s)') class-attribute instance-attribute

True if the respondent did not use transit because they prefer other mode(s)

reasons_no_transit_ride_too_long = Field(..., description='True if the respondent did not use transit because it takes too long') class-attribute instance-attribute

True if the respondent did not use transit because it takes too long

reasons_no_transit_stop_too_far = Field(..., description='True if the respondent did not use transit because the stop is too far') class-attribute instance-attribute

True if the respondent did not use transit because the stop is too far

reasons_no_transit_too_complicated = Field(..., description='True if the respondent did not use transit because it too complicated') class-attribute instance-attribute

True if the respondent did not use transit because it is too complicated.

reasons_no_transit_too_many_transfers = Field(..., description='True if the respondent did not use transit because it requries too many transfers') class-attribute instance-attribute

True if the respondent did not use transit because it requires too many transfers

reasons_no_transit_too_much_walking_stairs = Field(..., description='True if the respondent did not use transit because it involves too much walking and/or stairs') class-attribute instance-attribute

True if the respondent did not use transit because it too much walking and/or stairs

reasons_no_transit_wait_too_long = Field(..., description='True if the respondent did not use transit because the wait time is too long') class-attribute instance-attribute

True if the respondent did not use transit because the wait time is too long

resident_visitor_arriving = Field(..., description='True if respondent lives outside San Diego Region and is going home by ground transportation') class-attribute instance-attribute

True if respondent lives outside San Diego Region and is going home by ground transportation

resident_visitor_followup = Field(..., description='If neither a resident or a visitor, whether the respondent is visiting San Diego') class-attribute instance-attribute

If neither a resident or a visitor, whether the respondent is visiting San Diego.

resident_visitor_general = Field(..., description='Whether a resident or a visitor of the San deigo airport service area') class-attribute instance-attribute

Whether a resident or a visitor of the San deigo airport service area.

sdia_accessmode_decision = Field(..., description='Factor which affects mode choice, for respondents who do not always used the same mode') class-attribute instance-attribute

Factor which affects mode choice, for respondents who do not always used the same mode.

sdia_accessmode_split_bicycle_electric_bikeshare = Field(..., description='True if the respondent used an electric bikeshare for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used an electric bikeshare for their trip to SDIA in the last 12 months

sdia_accessmode_split_bicycle_non_electric_bikeshare = Field(..., description='True if the respondent used a non-electric bikeshare for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a non-electric bikeshare for their trip to SDIA in the last 12 months

sdia_accessmode_split_bicycle_personal_electric_bicycle = Field(..., description='True if the respondent used a personal electric bicycle for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a personal electric bicycle for their trip to SDIA in the last 12 months

sdia_accessmode_split_bicycle_personal_non_electric_bicycle = Field(..., description='True if the respondent used a personal non-electric bicycle for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a personal non-electric bicycle for their trip to SDIA in the last 12 months

sdia_accessmode_split_car_black = Field(..., description='True if the respondent used a black car or luxury service for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a black car or luxury service for their trip to SDIA in the last 12 months

sdia_accessmode_split_chartered_tour_bus = Field(..., description='True if the respondent used a chartered tour bus for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a chartered tour bus for their trip to SDIA in the last 12 months

sdia_accessmode_split_dropped_off_by_family_friend = Field(..., description='True if the respondent was dropped off by a family member or friend for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent was dropped off by a family member or friend for their trip to SDIA in the last 12 months

sdia_accessmode_split_drove_alone_and_parked = Field(..., description='True if the respondent drove alone and parked at SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent drove alone and parked at SDIA in the last 12 months

sdia_accessmode_split_drove_with_others_and_parked = Field(..., description='True if the respondent drove with others and parked at SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent drove with others and parked at SDIA in the last 12 months

sdia_accessmode_split_e_scooter_personal = Field(..., description='True if the respondent used a personal electric scooter for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a personal electric scooter for their trip to SDIA in the last 12 months

sdia_accessmode_split_e_scooter_shared = Field(..., description='True if the respondent used a shared electric scooter for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a shared electric scooter for their trip to SDIA in the last 12 months

sdia_accessmode_split_employee_shuttle = Field(..., description='True if the respondent used an employee shuttle for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used an employee shuttle for their trip to SDIA in the last 12 months

sdia_accessmode_split_flyer_shuttle = Field(..., description='True if the respondent used the Flyer Shuttle for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used the Flyer Shuttle for their trip to SDIA in the last 12 months

sdia_accessmode_split_hotel_shuttle_van = Field(..., description='True if the respondent used a hotel shuttle van for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a hotel shuttle van for their trip to SDIA in the last 12 months

sdia_accessmode_split_list = Field(..., description='List of modes used by the respondent for their trip to SDIA in the last 12 months') class-attribute instance-attribute

List of modes used by the respondent for their trip to SDIA in the last 12 months.

sdia_accessmode_split_mts992 = Field(..., description='True if the respondent used MTS992 for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used MTS992 for their trip to SDIA in the last 12 months

sdia_accessmode_split_other = Field(..., description='Other mode the respondent used for their trip to SDIA in the last 12 months') class-attribute instance-attribute

Other mode the respondent used for their trip to SDIA in the last 12 months.

sdia_accessmode_split_other_public_transit = Field(..., description='True if the respondent used another form of public transit for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used another form of public transit for their trip to SDIA in the last 12 months

sdia_accessmode_split_other_shared_van = Field(..., description='True if the respondent used another type of shared van service for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used another type of shared van service for their trip to SDIA in the last 12 months

sdia_accessmode_split_rental_car_dropped_off = Field(..., description='True if the respondent used a rental car and was dropped off at SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a rental car and was dropped off at SDIA in the last 12 months

sdia_accessmode_split_rental_car_parked = Field(..., description='True if the respondent parked a rental car at SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent parked a rental car at SDIA in the last 12 months

sdia_accessmode_split_rode_with_other_travelers_and_parked = Field(..., description='True if the respondent rode with other travelers and parked at SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent rode with other travelers and parked at SDIA in the last 12 months

sdia_accessmode_split_taxi = Field(..., description='True if the respondent used taxi as a mode for his trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used taxi as a mode for his trip to SDIA in the last 12 months

sdia_accessmode_split_uber_lyft = Field(..., description='True if the respondent used Uber or Lyft as a mode for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used Uber or Lyft as a mode for their trip to SDIA in the last 12 months

sdia_accessmode_split_walk = Field(..., description='True if the respondent walked to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent walked to SDIA in the last 12 months

sdia_accessmode_split_wheelchair = Field(..., description='True if the respondent used a wheelchair for their trip to SDIA in the last 12 months') class-attribute instance-attribute

True if the respondent used a wheelchair for their trip to SDIA in the last 12 months

sdia_flight_frequency = Field(..., description="Respondent's number of flights from SDIA in the past 12 months") class-attribute instance-attribute

Respondent’s number of flights from SDIA in the past 12 months.

sdia_transit_awareness = Field(..., description='Whether respondent is aware that buses are serving SDIA') class-attribute instance-attribute

Whether respondent is aware that buses are serving SDIA

state_of_residence = Field(..., description='State of residence for US and Mexico residents') class-attribute instance-attribute

State of residence for US and Mexico residents.

ArrivingAirPassenger

Bases: AirPassenger

Data model for an arriving air passenger. It includes attributes specific to arriving air passengers.

Source code in data_model/data_model.py
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
class ArrivingAirPassenger(AirPassenger):
    """
    Data model for an arriving air passenger. It includes attributes specific to arriving air passengers.
    """

    @computed_field(
        return_type = str,
        description = "Previous flight origin for an arriving passenger",
    )
    @property
    def previous_flight_origin(cls):
        """
        Previous flight origin for an arriving passenger
        """
        if cls.passenger_type == e.PassengerType.ARRIVING:
            return cls.previous_or_next_airport

    @computed_field(
        return_type = bool,
        description = "True if the previous flight origin was original and not a layover",
    )
    @property
    def is_original_origin(cls):
        """
        True if the previous flight origin was original and not a layover
        """
        return cls.is_direct_flight

    flight_arrival_time: NoneOrNan[e.DepartTime] = Field(
        ..., description = "Time of flight arrival"
    )
    """
    Time of flight arrival.
    """

    original_flight_origin: NoneOrNanString[str] = Field(
        ..., description = "Original origin for arriving passengers"
    )
    """
    Original origin for arriving passengers.
    """

flight_arrival_time = Field(..., description='Time of flight arrival') class-attribute instance-attribute

Time of flight arrival.

is_original_origin property

True if the previous flight origin was original and not a layover

original_flight_origin = Field(..., description='Original origin for arriving passengers') class-attribute instance-attribute

Original origin for arriving passengers.

previous_flight_origin property

Previous flight origin for an arriving passenger

ArrivingPassengerResident

Bases: ArrivingAirPassenger, Resident

Data Model for a departing air passenger who is a resident of the San Deigo Region.

Source code in data_model/data_model.py
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
class ArrivingPassengerResident(ArrivingAirPassenger, Resident):
    """
    Data Model for a departing air passenger who is a resident of the San Deigo Region. 
    """

    reverse_mode: NoneOrNan[e.TravelMode] = Field(
        ..., description = "Mode that was used in the reverse direction"
    )
    """
    Mode that was used in the reverse direction.
    """

    @model_validator(mode="after")
    def validate_record(cls, values):
        # Validate using SkipLogicValidator
        errors, severity_levels, num_errors = skip_logic_validator.validate("ArrivingPassengerResident", values.dict())
        # Update validation fields
        #values.valid_record = len(errors) == 0
        values.validation_error = errors
        values.validation_severity = cls.determine_severity(severity_levels)
        values.validation_num_errors = num_errors

        return values

    @staticmethod
    def determine_severity(severity_levels):
        if severity_levels["Critical"] > 0:
            return "Critical"
        elif severity_levels["Non-Critical"] > 0:
            return "Non-Critical"
        return "None"

    pass

reverse_mode = Field(..., description='Mode that was used in the reverse direction') class-attribute instance-attribute

Mode that was used in the reverse direction.

ArrivingPassengerVisitor

Bases: ArrivingAirPassenger, Visitor

Data Model for an arriving air passenger who is a visitor of the San Deigo Region.

Source code in data_model/data_model.py
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
class ArrivingPassengerVisitor(ArrivingAirPassenger, Visitor):
    """
    Data Model for an arriving air passenger who is a visitor of the San Deigo Region. 
    """

    reverse_mode_predicted: NoneOrNan[e.TravelMode] = Field(
        ..., description = "Mode that will be used in the reverse direction"
    )
    """
    Mode that will be used in the reverse direction.
    """

    reverse_mode_predicted_other: NoneOrNanString[str] = Field(
        ..., description = "Mode (not listed) which will be used in the reverse direction"
    )
    """
    Mode (not listed) which will be used in the reverse direction
    """

    # @model_validator(mode="after")
    # def validate_missing_fields(cls, values):
    #     null_fields = [field for field, value in values if value is None and 'other' not in field]
    #     critical_fields = ['party_size_flight']
    #     if null_fields:
    #         values.valid_record = False
    #         values.validation_error = f"Missing Fields: {', '.join(null_fields)}"
    #         values.validation_num_errors = len(null_fields)
    #         if len(null_fields)>3:
    #             values.validation_severity = "High"
    #         else:
    #             values.validation_severity = "Low"
    #         if any(field in critical_fields for field in null_fields):
    #             values.validation_severity = "Critical"
    #     return values

    @model_validator(mode="after")
    def validate_record(cls, values):
        # Validate using SkipLogicValidator
        errors, severity_levels, num_errors = skip_logic_validator.validate("ArrivingPassengerVisitor", values.dict())

        # Update validation fields
        #values.valid_record = len(errors) == 0
        values.validation_error = errors
        values.validation_severity = cls.determine_severity(severity_levels)
        values.validation_num_errors = num_errors

        return values

    @staticmethod
    def determine_severity(severity_levels):
        if severity_levels["Critical"] > 0:
            return "Critical"
        elif severity_levels["Non-Critical"] > 0:
            return "Non-Critical"
        return "None"

    pass

reverse_mode_predicted = Field(..., description='Mode that will be used in the reverse direction') class-attribute instance-attribute

Mode that will be used in the reverse direction.

reverse_mode_predicted_other = Field(..., description='Mode (not listed) which will be used in the reverse direction') class-attribute instance-attribute

Mode (not listed) which will be used in the reverse direction

DepartingAirPassenger

Bases: AirPassenger

Data model for a departing air passenger. It includes attributes specific to departing air passengers.

Source code in data_model/data_model.py
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
class DepartingAirPassenger(AirPassenger):
    """
    Data model for a departing air passenger. It includes attributes specific to departing air passengers.
    """

    @computed_field(
        return_type = str,
        description = "Next Flight Destination for a departing passenger",
    )
    @property
    def next_flight_destination(cls):
        """
        Next Flight Destination for a departing passenger
        """
        return cls.previous_or_next_airport

    @computed_field(
        return_type = bool,
        description = "True if the next flight destination is final and not a layover",
    )
    @property
    def is_final_destination(cls):
        """
        True if the next flight destination is final and not a layover
        """
        if cls.passenger_type == e.PassengerType.DEPARTING:
            return cls.is_direct_flight

    final_flight_destination: NoneOrNanString[str] = Field(
        ..., description = "Final destination of the flight for departing passengers"
    )
    """
    Final destination of the flight for departing passengers.
    """

    flight_departure_time: NoneOrNan[e.DepartTime] = Field(
        ..., description = "Time of flight departure"
    )
    """
    Time of flight departure.
    """

    trip_start_time: NoneOrNan[e.DepartTime] = Field(
        ..., description="Start time of the trip"
    )
    """
    Start time of the trip.
    """

    trip_arrival_time: NoneOrNan[e.DepartTime] = Field(
        ..., description="Arrival time of the trip"
    )
    """
    Arrival time of the trip.
    """

final_flight_destination = Field(..., description='Final destination of the flight for departing passengers') class-attribute instance-attribute

Final destination of the flight for departing passengers.

flight_departure_time = Field(..., description='Time of flight departure') class-attribute instance-attribute

Time of flight departure.

is_final_destination property

True if the next flight destination is final and not a layover

next_flight_destination property

Next Flight Destination for a departing passenger

trip_arrival_time = Field(..., description='Arrival time of the trip') class-attribute instance-attribute

Arrival time of the trip.

trip_start_time = Field(..., description='Start time of the trip') class-attribute instance-attribute

Start time of the trip.

DepartingPassengerResident

Bases: DepartingAirPassenger, Resident

Data Model for a departing air passenger who is a resident of the San Deigo Region.

Source code in data_model/data_model.py
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
class DepartingPassengerResident(DepartingAirPassenger, Resident):
    """
    Data Model for a departing air passenger who is a resident of the San Deigo Region. 
    """
    car_available: NoneOrNanString[e.CarAvailability] = Field(
        ..., description = "Status of car availability for the trip to the airport"
    )
    """
    Status of car availability for the trip to the airport
    """

    car_available_other: NoneOrNanString[str] = Field(
        ..., description = "Status of car availability (other than listed) for the trip to the airport"
    )
    """
    Status of car availability (other than listed) for the trip to the airport
    """

    reverse_mode_predicted: NoneOrNan[e.TravelMode] = Field(
        ..., description = "Mode that will be used in the reverse direction"
    )
    """
    Mode that will be used in the reverse direction.
    """

    reverse_mode_predicted_grouped: NoneOrNanString[e.TravelModeGrouped] = Field(
        ..., description = "Grouped Mode that will be used in the reverse direction")
    """
    Grouped Mode that will be used in the reverse direction
    """

    reverse_mode_predicted_other: NoneOrNanString[str] = Field(
        ..., description = "Mode (not listed) which will be used in the reverse direction"
    )
    """
    Mode (not listed) which will be used in the reverse direction
    """

    @model_validator(mode="after")
    def validate_record(cls, values):
        # Validate using SkipLogicValidator
        errors, severity_levels, num_errors = skip_logic_validator.validate("DepartingpassengerResident", values.dict())
        # Update validation fields
        #values.valid_record = len(errors) == 0
        values.validation_error = errors
        values.validation_severity = cls.determine_severity(severity_levels)
        values.validation_num_errors = num_errors

        return values

    @staticmethod
    def determine_severity(severity_levels):
        if severity_levels["Critical"] > 0:
            return "Critical"
        elif severity_levels["Non-Critical"] > 0:
            return "Non-Critical"
        return "None"
    pass 

car_available = Field(..., description='Status of car availability for the trip to the airport') class-attribute instance-attribute

Status of car availability for the trip to the airport

car_available_other = Field(..., description='Status of car availability (other than listed) for the trip to the airport') class-attribute instance-attribute

Status of car availability (other than listed) for the trip to the airport

reverse_mode_predicted = Field(..., description='Mode that will be used in the reverse direction') class-attribute instance-attribute

Mode that will be used in the reverse direction.

reverse_mode_predicted_grouped = Field(..., description='Grouped Mode that will be used in the reverse direction') class-attribute instance-attribute

Grouped Mode that will be used in the reverse direction

reverse_mode_predicted_other = Field(..., description='Mode (not listed) which will be used in the reverse direction') class-attribute instance-attribute

Mode (not listed) which will be used in the reverse direction

DepartingPassengerVisitor

Bases: DepartingAirPassenger, Visitor

Data Model for a departing air passenger who is a resident of the San Deigo Region.

Source code in data_model/data_model.py
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
class DepartingPassengerVisitor(DepartingAirPassenger, Visitor):

    """
    Data Model for a departing air passenger who is a resident of the San Deigo Region. 
    """

    reverse_mode: NoneOrNan[e.TravelMode] = Field(
        ..., description = "Mode that was used in the reverse direction"
    )
    """
    Mode that was used in the reverse direction.
    """

    reverse_mode_grouped: NoneOrNanString[e.TravelModeGrouped] = Field(
        ..., description = "Grouped Mode that was used in the reverse direction")
    """
    Grouped Mode that was used in the reverse direction
    """
    reverse_mode_combined: NoneOrNanString[e.TravelModeGrouped] = Field(
        ..., description = "Mode in the reverse direction")
    """
    Mode in the reverse direction.
    """

    reverse_mode_combined_other: NoneOrNanString[str] = Field(
        ..., description = "Other mode in the reverse direction")
    """
    Other mode in the reverse direction.
    """


    general_modes_used_visitor_taxi: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used Taxi as a mode during their visit to the San Diego Region"
    )
    """
    True if the visitor used Taxi as a mode during their visit to the San Diego Region.
    """

    general_modes_used_visitor_uber_lyft: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used Uber or Lyft as a mode during their visit to the San Diego Region"
    )
    """
    True if the visitor used Uber or Lyft as a mode during their visit to the San Diego Region.
    """

    general_modes_used_visitor_car_black: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used a black car service as a mode during their visit to the San Diego Region"
    )
    """
    True if the visitor used a black car service as a mode during their visit to the San Diego Region.
    """

    general_modes_used_visitor_dropped_off_by_family_friend: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor was dropped off by a family member or friend during their visit to the San Diego Region"
    )
    """
    True if the visitor was dropped off by a family member or friend during their visit to the San Diego Region.
    """

    general_modes_used_visitor_drove_alone_and_parked: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor drove alone and parked during their visit to the San Diego Region"
    )
    """
    True if the visitor drove alone and parked during their visit to the San Diego Region.
    """

    general_modes_used_visitor_drove_with_others_and_parked: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor drove with others and parked during their visit to the San Diego Region"
    )
    """
    True if the visitor drove with others and parked during their visit to the San Diego Region.
    """

    general_modes_used_visitor_rode_with_other_travelers_and_parked: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor rode with other travelers and parked during their visit to the San Diego Region"
    )
    """
    True if the visitor rode with other travelers and parked during their visit to the San Diego Region.
    """

    general_modes_used_visitor_coaster: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used the Coaster train during their visit to the San Diego Region"
    )
    """
    True if the visitor used the Coaster train during their visit to the San Diego Region.
    """

    general_modes_used_visitor_mts_red_trolley: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used the MTS Red Trolley during their visit to the San Diego Region"
    )
    """
    True if the visitor used the MTS Red Trolley during their visit to the San Diego Region.
    """

    general_modes_used_visitor_other_public_bus: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used other public bus services during their visit to the San Diego Region"
    )
    """
    True if the visitor used other public bus services during their visit to the San Diego Region.
    """

    general_modes_used_visitor_other_public_transit: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used other public transit services during their visit to the San Diego Region"
    )
    """
    True if the visitor used other public transit services during their visit to the San Diego Region.
    """

    general_modes_used_visitor_rental_car_dropped_off: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used a rental car and was dropped off during their visit to the San Diego Region"
    )
    """
    True if the visitor used a rental car and was dropped off during their visit to the San Diego Region.
    """

    general_modes_used_visitor_rental_car_parked: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used a rental car and parked during their visit to the San Diego Region"
    )
    """
    True if the visitor used a rental car and parked during their visit to the San Diego Region.
    """

    general_modes_used_visitor_chartered_tour_bus: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used a chartered tour bus during their visit to the San Diego Region"
    )
    """
    True if the visitor used a chartered tour bus during their visit to the San Diego Region.
    """

    general_modes_used_visitor_hotel_shuttle_van: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used a hotel shuttle or van during their visit to the San Diego Region"
    )
    """
    True if the visitor used a hotel shuttle or van during their visit to the San Diego Region.
    """

    general_modes_used_visitor_employee_shuttle: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used an employee shuttle during their visit to the San Diego Region"
    )
    """
    True if the visitor used an employee shuttle during their visit to the San Diego Region.
    """

    general_modes_used_visitor_other_shared_van: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used another type of shared van service during their visit to the San Diego Region"
    )
    """
    True if the visitor used another type of shared van service during their visit to the San Diego Region.
    """

    general_modes_used_visitor_walk: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor walked as a mode during their visit to the San Diego Region"
    )
    """
    True if the visitor walked as a mode during their visit to the San Diego Region.
    """

    general_modes_used_visitor_wheelchair: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used a wheelchair during their visit to the San Diego Region"
    )
    """
    True if the visitor used a wheelchair during their visit to the San Diego Region.
    """

    general_modes_used_visitor_bicycle_electric_bikeshare: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used an electric bicycle through a bikeshare service during their visit to the San Diego Region"
    )
    """
    True if the visitor used an electric bicycle through a bikeshare service during their visit to the San Diego Region.
    """

    general_modes_used_visitor_bicycle_non_electric_bikeshare: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used a non-electric bicycle through a bikeshare service during their visit to the San Diego Region"
    )
    """
    True if the visitor used a non-electric bicycle through a bikeshare service during their visit to the San Diego Region.
    """

    general_modes_used_visitor_bicycle_personal_electric_bicycle: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used their personal electric bicycle during their visit to the San Diego Region"
    )
    """
    True if the visitor used their personal electric bicycle during their visit to the San Diego Region.
    """

    general_modes_used_visitor_bicycle_personal_non_electric_bicycle: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used their personal non-electric bicycle during their visit to the San Diego Region"
    )
    """
    True if the visitor used their personal non-electric bicycle during their visit to the San Diego Region.
    """

    general_modes_used_visitor_e_scooter_shared: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used a shared e-scooter during their visit to the San Diego Region"
    )
    """
    True if the visitor used a shared e-scooter during their visit to the San Diego Region.
    """

    general_modes_used_visitor_e_scooter_personal: NoneOrNanString[bool] = Field(
        ..., description = "True if the visitor used their personal e-scooter during their visit to the San Diego Region"
    )
    """
    True if the visitor used their personal e-scooter during their visit to the San Diego Region.
    """

    general_modes_used_visitor_other: NoneOrNanString[str] = Field(
        ..., description = "Other mode used by the visitor during their visit to the San Diego Region."
    )
    """
    Other mode used by the visitor during their visit to the San Diego Region.
    """

    general_modes_used_visitor_list: NoneOrNanString[str] = Field(
        ..., description = "List of modes used by the visitor during their visit to the San Diego Region"
    )
    """
    List of modes used by the visitor during their visit to the San Diego Region
    """

    @model_validator(mode="after")
    def validate_record(cls, values):
        # Validate using SkipLogicValidator
        errors, severity_levels, num_errors = skip_logic_validator.validate("DepartingPassengerVisitor", values.dict())
        # Update validation fields
        #values.valid_record = len(errors) == 0
        values.validation_error = errors
        values.validation_severity = cls.determine_severity(severity_levels)
        values.validation_num_errors = num_errors

        return values

    @staticmethod
    def determine_severity(severity_levels):
        if severity_levels["Critical"] > 0:
            return "Critical"
        elif severity_levels["Non-Critical"] > 0:
            return "Non-Critical"
        return "None"
    pass

general_modes_used_visitor_bicycle_electric_bikeshare = Field(..., description='True if the visitor used an electric bicycle through a bikeshare service during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used an electric bicycle through a bikeshare service during their visit to the San Diego Region.

general_modes_used_visitor_bicycle_non_electric_bikeshare = Field(..., description='True if the visitor used a non-electric bicycle through a bikeshare service during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used a non-electric bicycle through a bikeshare service during their visit to the San Diego Region.

general_modes_used_visitor_bicycle_personal_electric_bicycle = Field(..., description='True if the visitor used their personal electric bicycle during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used their personal electric bicycle during their visit to the San Diego Region.

general_modes_used_visitor_bicycle_personal_non_electric_bicycle = Field(..., description='True if the visitor used their personal non-electric bicycle during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used their personal non-electric bicycle during their visit to the San Diego Region.

general_modes_used_visitor_car_black = Field(..., description='True if the visitor used a black car service as a mode during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used a black car service as a mode during their visit to the San Diego Region.

general_modes_used_visitor_chartered_tour_bus = Field(..., description='True if the visitor used a chartered tour bus during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used a chartered tour bus during their visit to the San Diego Region.

general_modes_used_visitor_coaster = Field(..., description='True if the visitor used the Coaster train during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used the Coaster train during their visit to the San Diego Region.

general_modes_used_visitor_dropped_off_by_family_friend = Field(..., description='True if the visitor was dropped off by a family member or friend during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor was dropped off by a family member or friend during their visit to the San Diego Region.

general_modes_used_visitor_drove_alone_and_parked = Field(..., description='True if the visitor drove alone and parked during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor drove alone and parked during their visit to the San Diego Region.

general_modes_used_visitor_drove_with_others_and_parked = Field(..., description='True if the visitor drove with others and parked during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor drove with others and parked during their visit to the San Diego Region.

general_modes_used_visitor_e_scooter_personal = Field(..., description='True if the visitor used their personal e-scooter during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used their personal e-scooter during their visit to the San Diego Region.

general_modes_used_visitor_e_scooter_shared = Field(..., description='True if the visitor used a shared e-scooter during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used a shared e-scooter during their visit to the San Diego Region.

general_modes_used_visitor_employee_shuttle = Field(..., description='True if the visitor used an employee shuttle during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used an employee shuttle during their visit to the San Diego Region.

general_modes_used_visitor_hotel_shuttle_van = Field(..., description='True if the visitor used a hotel shuttle or van during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used a hotel shuttle or van during their visit to the San Diego Region.

general_modes_used_visitor_list = Field(..., description='List of modes used by the visitor during their visit to the San Diego Region') class-attribute instance-attribute

List of modes used by the visitor during their visit to the San Diego Region

general_modes_used_visitor_mts_red_trolley = Field(..., description='True if the visitor used the MTS Red Trolley during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used the MTS Red Trolley during their visit to the San Diego Region.

general_modes_used_visitor_other = Field(..., description='Other mode used by the visitor during their visit to the San Diego Region.') class-attribute instance-attribute

Other mode used by the visitor during their visit to the San Diego Region.

general_modes_used_visitor_other_public_bus = Field(..., description='True if the visitor used other public bus services during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used other public bus services during their visit to the San Diego Region.

general_modes_used_visitor_other_public_transit = Field(..., description='True if the visitor used other public transit services during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used other public transit services during their visit to the San Diego Region.

general_modes_used_visitor_other_shared_van = Field(..., description='True if the visitor used another type of shared van service during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used another type of shared van service during their visit to the San Diego Region.

general_modes_used_visitor_rental_car_dropped_off = Field(..., description='True if the visitor used a rental car and was dropped off during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used a rental car and was dropped off during their visit to the San Diego Region.

general_modes_used_visitor_rental_car_parked = Field(..., description='True if the visitor used a rental car and parked during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used a rental car and parked during their visit to the San Diego Region.

general_modes_used_visitor_rode_with_other_travelers_and_parked = Field(..., description='True if the visitor rode with other travelers and parked during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor rode with other travelers and parked during their visit to the San Diego Region.

general_modes_used_visitor_taxi = Field(..., description='True if the visitor used Taxi as a mode during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used Taxi as a mode during their visit to the San Diego Region.

general_modes_used_visitor_uber_lyft = Field(..., description='True if the visitor used Uber or Lyft as a mode during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used Uber or Lyft as a mode during their visit to the San Diego Region.

general_modes_used_visitor_walk = Field(..., description='True if the visitor walked as a mode during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor walked as a mode during their visit to the San Diego Region.

general_modes_used_visitor_wheelchair = Field(..., description='True if the visitor used a wheelchair during their visit to the San Diego Region') class-attribute instance-attribute

True if the visitor used a wheelchair during their visit to the San Diego Region.

reverse_mode = Field(..., description='Mode that was used in the reverse direction') class-attribute instance-attribute

Mode that was used in the reverse direction.

reverse_mode_combined = Field(..., description='Mode in the reverse direction') class-attribute instance-attribute

Mode in the reverse direction.

reverse_mode_combined_other = Field(..., description='Other mode in the reverse direction') class-attribute instance-attribute

Other mode in the reverse direction.

reverse_mode_grouped = Field(..., description='Grouped Mode that was used in the reverse direction') class-attribute instance-attribute

Grouped Mode that was used in the reverse direction

Employee

Bases: Respondent

Data model for an employee respondent. It includes attributes specific to employees.

Source code in data_model/data_model.py
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
class Employee(Respondent):
    """
    Data model for an employee respondent. It includes attributes specific to employees.
    """

    # shift_start_location: NoneOrNan[Coord] = Field(
    #     ..., description = "Longitude and Latitude of building where the employee starts their shift"
    # )
    # """
    # Longitude and Latitude of building where the employee starts their shift.
    # """

    trip_start_time: NoneOrNan[e.DepartTime] = Field(
        ..., description="Start time of the trip"
    )
    """
    Start time of the trip.
    """

    trip_arrival_time: NoneOrNan[e.DepartTime] = Field(
        ..., description="Arrival time of the trip"
    )
    """
    Arrival time of the trip.
    """

    shift_start_airport_building: NoneOrNanString[e.SanBuildings] = Field(
        ..., description = "Name of building where employee starts their shift"
    )
    """
    Name of building where employee starts their shift.
    """

    shift_start_airport_building_other: NoneOrNanString[str] = Field(
        ..., description = "Name of building (not listed) where employee starts their shift"
    )
    """
    Name of building (not listed) where employee starts their shift.
    """

    employer: NoneOrNanString[e.Employers] = Field(
        ..., description = "Name of respondent's employer"
    )
    """
    Name of  respondent's employer.
    """

    employer_other: NoneOrNanString[str] = Field(
        ..., description = "Name (not listed) of respondent's employer"
    )
    """
    Name (not listed) of respondent's employer.
    """

    occupation: NoneOrNanString[e.Occupations] = Field(
        ..., description = "Occupation of the employee"
    )
    """
    Occupation of the employee.
    """

    occupation_other: NoneOrNanString[str] = Field(
        ..., description = "Occupation (other, not listed) of the employee"
    )
    """
    Occupation (other, not listed) of the employee
    """

    occupation_detail: NoneOrNan[e.OccupationDetail] = Field(
        ..., description = "Occupation Details for the airport employee"
    )
    """
    Occupation Details for the airport employee
    """

    number_hours_worked: NoneOrNan[e.HoursWorked] = Field(
        ..., description = "Number of hours respondent worked in the past 7 days"
    )
    """
    Number of hours respondent worked in the past 7 days.
    """

    number_commute_days: NoneOrNan[e.CommuteDays] = Field(
        ..., description = "Number of days respondent commuted to the airport in the past 7 days"
    )
    """
    Number of days respondent commuted to the airport in the past 7 days.
    """

    shift_start_time: NoneOrNan[e.DepartTime] = Field(
        ..., description = "Time when the employee's shift starts"
    )
    """
    Time when the employee's shift starts.
    """

    shift_end_time: NoneOrNan[e.DepartTime] = Field(
        ..., description = "Time when the employee's shift ends"
    )
    """
    Time when the employee's shift ends.
    """
# Add New Here

    reverse_commute_mode: NoneOrNan[e.TravelMode] = Field(
        ..., description = "Reverse commute mode for the employee"
    )
    """
    Reverse commute mode for the employee
    """

    reverse_commute_mode_other: NoneOrNanString[str] = Field(
        ..., description = "Reverse commute mode for the employee (other, not listed)"
    )
    """
    Reverse commute mode for the employee (other, not listed)
    """

    reverse_commute_mode_grouped: NoneOrNanString[e.TravelModeGrouped] = Field(
        ..., description = "Grouped reverse commute mode for the employee"
    )
    """
    Grouped reverse commute mode for the employee
    """

    same_commute_mode: NoneOrNanString[e.YesNoType] = Field(
        ..., description = "True if the employee always used the same travel mode to commute in the last 30 days"
    )
    """
    True if the employee always used the same travel mode to commute in the last 30 days
    """

    same_commute_mode_other: NoneOrNanString[str] = Field(
        ..., description = "Other Response to employee's travel mode to commute in the last 30 days"
    )
    """
    Other Response to employee's travel mode to commute in the last 30 days
    """

    alt_commute_mode_taxi: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used Taxi as a mode to commute to the airport in the past 30 days"
    )
    """
    True if the employee used Taxi as a mode to commute to the airport in the past 30 days.
    """

    alt_commute_mode_uber_lyft: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used Uber or Lyft as a mode to commute to the airport in the past 30 days"
    )
    """
    True if the employee used Uber or Lyft as a mode to commute to the airport in the past 30 days.
    """

    alt_commute_mode_car_black: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used a black car service as a mode to commute to the airport in the past 30 days"
    )
    """
    True if the employee used a black car service as a mode to commute to the airport in the past 30 days.
    """

    alt_commute_mode_picked_by_family_friend: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee was picked up by a family member or friend to commute to the airport in the past 30 days"
    )
    """
    True if the employee was picked up by a family member or friend to commute to the airport in the past 30 days.
    """

    alt_commute_mode_parked_vehicle_and_drive_alone: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee drove alone and parked their vehicle while commuting to the airport in the past 30 days"
    )
    """
    True if the employee drove alone and parked their vehicle while commuting to the airport in the past 30 days.
    """

    alt_commute_mode_parked_vehicle_and_drive_with_others: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee drove with others and parked their vehicle while commuting to the airport in the past 30 days"
    )
    """
    True if the employee drove with others and parked their vehicle while commuting to the airport in the past 30 days.
    """

    alt_commute_mode_parked_vehicle_and_ride_with_other_travelers: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee rode with other travelers and parked their vehicle while commuting to the airport in the past 30 days"
    )
    """
    True if the employee rode with other travelers and parked their vehicle while commuting to the airport in the past 30 days.
    """

    alt_commute_mode_mts_route_992: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used MTS Route 992 to commute to the airport in the past 30 days"
    )
    """
    True if the employee used MTS Route 992 to commute to the airport in the past 30 days.
    """

    alt_commute_mode_airport_flyer_shuttle: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used the Airport Flyer Shuttle to commute to the airport in the past 30 days"
    )
    """
    True if the employee used the Airport Flyer Shuttle to commute to the airport in the past 30 days.
    """

    alt_commute_mode_other_public_transit: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used other public transit services to commute to the airport in the past 30 days"
    )
    """
    True if the employee used other public transit services to commute to the airport in the past 30 days.
    """

    alt_commute_mode_other_shared_van: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used another type of shared van service to commute to the airport in the past 30 days"
    )
    """
    True if the employee used another type of shared van service to commute to the airport in the past 30 days.
    """

    alt_commute_mode_walk: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee walked as a mode to commute to the airport in the past 30 days"
    )
    """
    True if the employee walked as a mode to commute to the airport in the past 30 days.
    """

    alt_commute_mode_wheelchair: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used a wheelchair to commute to the airport in the past 30 days"
    )
    """
    True if the employee used a wheelchair to commute to the airport in the past 30 days.
    """

    alt_commute_mode_bicycle_electric_bikeshare: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used an electric bicycle through a bikeshare service to commute to the airport in the past 30 days"
    )
    """
    True if the employee used an electric bicycle through a bikeshare service to commute to the airport in the past 30 days.
    """

    alt_commute_mode_bicycle_non_electric_bikeshare: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used a non-electric bicycle through a bikeshare service to commute to the airport in the past 30 days"
    )
    """
    True if the employee used a non-electric bicycle through a bikeshare service to commute to the airport in the past 30 days.
    """

    alt_commute_mode_bicycle_personal_electric_bicycle: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used their personal electric bicycle to commute to the airport in the past 30 days"
    )
    """
    True if the employee used their personal electric bicycle to commute to the airport in the past 30 days.
    """

    alt_commute_mode_bicycle_personal_non_electric_bicycle: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used their personal non-electric bicycle to commute to the airport in the past 30 days"
    )
    """
    True if the employee used their personal non-electric bicycle to commute to the airport in the past 30 days.
    """

    alt_commute_mode_e_scooter_shared: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used a shared e-scooter to commute to the airport in the past 30 days"
    )
    """
    True if the employee used a shared e-scooter to commute to the airport in the past 30 days.
    """

    alt_commute_mode_e_scooter_personal: NoneOrNanString[bool] = Field(
        ..., description = "True if the employee used their personal e-scooter to commute to the airport in the past 30 days"
    )
    """
    True if the employee used their personal e-scooter to commute to the airport in the past 30 days.
    """

    alt_commute_mode_other: NoneOrNanString[str] = Field(
        ..., description = "Other mode used by the employee to commute to the airport in the past 30 days."
    )
    """
    Other mode used by the employee to commute to the airport in the past 30 days
    """

    alt_commute_mode_list: NoneOrNanString[str] = Field(
        ..., description = "List of modes used by the employee to commute to the airport in the past 30 days.")
    """
    List of modes used by the employee to commute to the airport in the past 30 days
    """


    commute_mode_decision: NoneOrNanString[e.ModeDecision] = Field(
        ..., description = "Factor affecting the Mode choice of the employee"
    )
    """
    Factor affecting the Mode choice of the employee
    """

    commute_mode_decision_other: NoneOrNanString[str] = Field(
        ..., description = "(Other) Factor affecting the Mode choice of the employee"
    )
    """
    (Other) Factor affecting the Mode choice of the employee
    """

    # past_commute_modes: List[NoneOrNan[e.TravelMode]] = Field(
    #     ..., description = "Modes used to commute to SDIA in the past 12 months"
    # )
    # """
    # Modes used to commute to SDIA in the past 12 months.
    # """

    # alternative_commute_modes: List[NoneOrNan[e.TravelMode]] = Field(
    #     ..., description = "Modes used to travel to SDIA in the past 30 days"
    # )
    # """
    # Modes used to travel to SDIA in the past 30 days.
    # """

    # commute_mode_decision: List[NoneOrNan[e.CommuteModeDecision]] = Field(
    #     ..., description = "Factors affecting mode choice, for respondents who do not always use the same mode"
    # )
    # """
    # Factors affecting mode choice, for respondents who do not always use the same mode.
    # """

    employee_parking: NoneOrNanString[bool] = Field(
        ..., description = "Whether the respondent has access to employee parking"
    )
    """
    Whether the respondent has access to employee parking.
    """

    # @model_validator(mode="after")
    # def validate_missing_fields(cls, values):
    #     null_fields = [field for field, value in values if value is None and 'other' not in field]
    #     critical_fields = []
    #     if null_fields:
    #         values.valid_record = False
    #         values.validation_error = f"Missing Fields: {', '.join(null_fields)}"
    #         values.validation_num_errors = len(null_fields)
    #         if len(null_fields)>3:
    #             values.validation_severity = "High"
    #         else:
    #             values.validation_severity = "Low"
    #         if any(field in critical_fields for field in null_fields):
    #             values.validation_severity = "Critical"
    #     return values

    @model_validator(mode="after")
    def validate_record(cls, values):
        # Validate using SkipLogicValidator
        errors, severity_levels, num_errors = skip_logic_validator.validate("Employee", values.dict())
        # Update validation fields
        #values.valid_record = len(errors) == 0
        values.validation_error = errors
        values.validation_severity = cls.determine_severity(severity_levels)
        values.validation_num_errors = num_errors

        return values

    @staticmethod
    def determine_severity(severity_levels):
        if severity_levels["Critical"] > 0:
            return "Critical"
        elif severity_levels["Non-Critical"] > 0:
            return "Non-Critical"
        return "None"

alt_commute_mode_airport_flyer_shuttle = Field(..., description='True if the employee used the Airport Flyer Shuttle to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used the Airport Flyer Shuttle to commute to the airport in the past 30 days.

alt_commute_mode_bicycle_electric_bikeshare = Field(..., description='True if the employee used an electric bicycle through a bikeshare service to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used an electric bicycle through a bikeshare service to commute to the airport in the past 30 days.

alt_commute_mode_bicycle_non_electric_bikeshare = Field(..., description='True if the employee used a non-electric bicycle through a bikeshare service to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used a non-electric bicycle through a bikeshare service to commute to the airport in the past 30 days.

alt_commute_mode_bicycle_personal_electric_bicycle = Field(..., description='True if the employee used their personal electric bicycle to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used their personal electric bicycle to commute to the airport in the past 30 days.

alt_commute_mode_bicycle_personal_non_electric_bicycle = Field(..., description='True if the employee used their personal non-electric bicycle to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used their personal non-electric bicycle to commute to the airport in the past 30 days.

alt_commute_mode_car_black = Field(..., description='True if the employee used a black car service as a mode to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used a black car service as a mode to commute to the airport in the past 30 days.

alt_commute_mode_e_scooter_personal = Field(..., description='True if the employee used their personal e-scooter to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used their personal e-scooter to commute to the airport in the past 30 days.

alt_commute_mode_e_scooter_shared = Field(..., description='True if the employee used a shared e-scooter to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used a shared e-scooter to commute to the airport in the past 30 days.

alt_commute_mode_list = Field(..., description='List of modes used by the employee to commute to the airport in the past 30 days.') class-attribute instance-attribute

List of modes used by the employee to commute to the airport in the past 30 days

alt_commute_mode_mts_route_992 = Field(..., description='True if the employee used MTS Route 992 to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used MTS Route 992 to commute to the airport in the past 30 days.

alt_commute_mode_other = Field(..., description='Other mode used by the employee to commute to the airport in the past 30 days.') class-attribute instance-attribute

Other mode used by the employee to commute to the airport in the past 30 days

alt_commute_mode_other_public_transit = Field(..., description='True if the employee used other public transit services to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used other public transit services to commute to the airport in the past 30 days.

alt_commute_mode_other_shared_van = Field(..., description='True if the employee used another type of shared van service to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used another type of shared van service to commute to the airport in the past 30 days.

alt_commute_mode_parked_vehicle_and_drive_alone = Field(..., description='True if the employee drove alone and parked their vehicle while commuting to the airport in the past 30 days') class-attribute instance-attribute

True if the employee drove alone and parked their vehicle while commuting to the airport in the past 30 days.

alt_commute_mode_parked_vehicle_and_drive_with_others = Field(..., description='True if the employee drove with others and parked their vehicle while commuting to the airport in the past 30 days') class-attribute instance-attribute

True if the employee drove with others and parked their vehicle while commuting to the airport in the past 30 days.

alt_commute_mode_parked_vehicle_and_ride_with_other_travelers = Field(..., description='True if the employee rode with other travelers and parked their vehicle while commuting to the airport in the past 30 days') class-attribute instance-attribute

True if the employee rode with other travelers and parked their vehicle while commuting to the airport in the past 30 days.

alt_commute_mode_picked_by_family_friend = Field(..., description='True if the employee was picked up by a family member or friend to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee was picked up by a family member or friend to commute to the airport in the past 30 days.

alt_commute_mode_taxi = Field(..., description='True if the employee used Taxi as a mode to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used Taxi as a mode to commute to the airport in the past 30 days.

alt_commute_mode_uber_lyft = Field(..., description='True if the employee used Uber or Lyft as a mode to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used Uber or Lyft as a mode to commute to the airport in the past 30 days.

alt_commute_mode_walk = Field(..., description='True if the employee walked as a mode to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee walked as a mode to commute to the airport in the past 30 days.

alt_commute_mode_wheelchair = Field(..., description='True if the employee used a wheelchair to commute to the airport in the past 30 days') class-attribute instance-attribute

True if the employee used a wheelchair to commute to the airport in the past 30 days.

commute_mode_decision = Field(..., description='Factor affecting the Mode choice of the employee') class-attribute instance-attribute

Factor affecting the Mode choice of the employee

commute_mode_decision_other = Field(..., description='(Other) Factor affecting the Mode choice of the employee') class-attribute instance-attribute

(Other) Factor affecting the Mode choice of the employee

employee_parking = Field(..., description='Whether the respondent has access to employee parking') class-attribute instance-attribute

Whether the respondent has access to employee parking.

employer = Field(..., description="Name of respondent's employer") class-attribute instance-attribute

Name of respondent’s employer.

employer_other = Field(..., description="Name (not listed) of respondent's employer") class-attribute instance-attribute

Name (not listed) of respondent’s employer.

number_commute_days = Field(..., description='Number of days respondent commuted to the airport in the past 7 days') class-attribute instance-attribute

Number of days respondent commuted to the airport in the past 7 days.

number_hours_worked = Field(..., description='Number of hours respondent worked in the past 7 days') class-attribute instance-attribute

Number of hours respondent worked in the past 7 days.

occupation = Field(..., description='Occupation of the employee') class-attribute instance-attribute

Occupation of the employee.

occupation_detail = Field(..., description='Occupation Details for the airport employee') class-attribute instance-attribute

Occupation Details for the airport employee

occupation_other = Field(..., description='Occupation (other, not listed) of the employee') class-attribute instance-attribute

Occupation (other, not listed) of the employee

reverse_commute_mode = Field(..., description='Reverse commute mode for the employee') class-attribute instance-attribute

Reverse commute mode for the employee

reverse_commute_mode_grouped = Field(..., description='Grouped reverse commute mode for the employee') class-attribute instance-attribute

Grouped reverse commute mode for the employee

reverse_commute_mode_other = Field(..., description='Reverse commute mode for the employee (other, not listed)') class-attribute instance-attribute

Reverse commute mode for the employee (other, not listed)

same_commute_mode = Field(..., description='True if the employee always used the same travel mode to commute in the last 30 days') class-attribute instance-attribute

True if the employee always used the same travel mode to commute in the last 30 days

same_commute_mode_other = Field(..., description="Other Response to employee's travel mode to commute in the last 30 days") class-attribute instance-attribute

Other Response to employee’s travel mode to commute in the last 30 days

shift_end_time = Field(..., description="Time when the employee's shift ends") class-attribute instance-attribute

Time when the employee’s shift ends.

shift_start_airport_building = Field(..., description='Name of building where employee starts their shift') class-attribute instance-attribute

Name of building where employee starts their shift.

shift_start_airport_building_other = Field(..., description='Name of building (not listed) where employee starts their shift') class-attribute instance-attribute

Name of building (not listed) where employee starts their shift.

shift_start_time = Field(..., description="Time when the employee's shift starts") class-attribute instance-attribute

Time when the employee’s shift starts.

trip_arrival_time = Field(..., description='Arrival time of the trip') class-attribute instance-attribute

Arrival time of the trip.

trip_start_time = Field(..., description='Start time of the trip') class-attribute instance-attribute

Start time of the trip.

Lat

Bases: BaseModel

Source code in data_model/data_model.py
163
164
165
class Lat(BaseModel):
    lat: Latitude
    """Latitude"""

lat instance-attribute

Latitude

Lng

Bases: BaseModel

Source code in data_model/data_model.py
167
168
169
class Lng(BaseModel):
    lng: Longitude
    """Longitude"""

lng instance-attribute

Longitude

PydanticModel

Bases: BaseModel

Base class for all Pydantic models, create in case future modifications are helpful

Source code in data_model/data_model.py
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
class PydanticModel(BaseModel):
    """
    Base class for all Pydantic models, create in case future modifications are helpful
    """

    # valid_record: bool = Field(
    #     default=True, description="Indicates if the record is valid")
    # """
    # Indicates if the record is valid
    # """

    validation_error: str = Field(
        default="", description="Holds validation error messages")
    """
    Holds the validation error message
    """

    validation_severity: str = Field(
        default = "", description = "Holds the severity of the validation error"
    )
    """
    Holds the severity of the validation error
    """

    validation_num_errors: int = Field(
        default = 0, description = "Number of missing (null) fields for the record"
    )
    """
    Number of missing (null) fields for the record
    """

    @model_validator(mode="before")
    def check_validation_of_numeric_value(cls, values):
        # List of fields to validate
        fields_to_check = ['taxi_fhv_fare', 'taxi_fhv_wait', 'parking_cost']

        for field in fields_to_check:
            value = values.get(field)
            if isinstance(value, datetime):
                values[field] = value.strftime('%Y-%m-%d %H:%M:%S') #change to pass through the data model anyway
                #values['valid_record'] = False
                values['validation_severity'] = "Low"
                values['validation_error'] = f"{field} is datetime"

        return values

validation_error = Field(default='', description='Holds validation error messages') class-attribute instance-attribute

Holds the validation error message

validation_num_errors = Field(default=0, description='Number of missing (null) fields for the record') class-attribute instance-attribute

Number of missing (null) fields for the record

validation_severity = Field(default='', description='Holds the severity of the validation error') class-attribute instance-attribute

Holds the severity of the validation error

Resident

Bases: Respondent

Data Model for a Air Passenger who is a resident of the San Deigo Region. It includes attributes specific to a Resident.

Source code in data_model/data_model.py
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
class Resident(Respondent):
    """
    Data Model for a Air Passenger who is a resident of the San Deigo Region. It includes attributes specific to a Resident.
    """

    nights_away: NoneOrNan[e.TravelDuration] = Field(
        ..., description = "Number of nights the departing air passengers will be away"
    )
    """
    Number of nights the departing air passengers will be away.
    """

    general_use_transit_resident: NoneOrNan[e.TransitUseFrequency] = Field(
        ..., description = "General transit use frequency by residents of San Diego region in San Diego region"
    )
    """
    General transit use frequency by residents of San Diego region in San Diego region.
    """
    pass

general_use_transit_resident = Field(..., description='General transit use frequency by residents of San Diego region in San Diego region') class-attribute instance-attribute

General transit use frequency by residents of San Diego region in San Diego region.

nights_away = Field(..., description='Number of nights the departing air passengers will be away') class-attribute instance-attribute

Number of nights the departing air passengers will be away.

Respondent

Bases: PydanticModel

Data model for a survey respondent. It includes attributes common to air passengers and employees.

Source code in data_model/data_model.py
 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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
class Respondent(PydanticModel):
    """
    Data model for a survey respondent. It includes attributes common to air passengers and employees.
    """

    is_completed: bool = Field(
        ..., description = "True if the record is complete"
    )
    """
    True if the record is complete
    """

    is_self_administered: bool = Field(
        default = False, description = "True if the survey was self-administered by the respondent")
    """
    True if the survey was self-administered by the respondent.
    """

    respondentid: Union[int,str] = Field(
        ..., description="Unique identifier for the respondent")
    """
    Unique identifier for the respondent.
    """

    is_pilot: bool = Field(
        ..., description = "True if the record was collected during the pilot survey"
    )
    """
    True if the record was collected during the pilot survey
    """

    record_type_synthetic: bool =  Field(
        ..., description = "True if the record is synthetically generated"
    )
    """
    True if the record is synthetically generated
    """


    date_completed: NoneOrNanString[datetime] = Field(
        ..., description = "Date when respondent completed the survey"
    )
    """
    Date when respondent completed the survey
    """

    time_completed: NoneOrNanString[time] = Field(
        ..., description = "Time when respondent completed the survey"
    )
    """
    Time when respondent completed the survey
    """


    initial_etc_check: NoneOrNanString[bool] = Field(
        ..., description = "True if the record passed ETC's initial check"
    )

    """
    True if the record is to be used for submittal
    """


    @computed_field(
        return_type = bool,
        description = "True if the record was captured during Thanksgiving Week",
    )
    @property
    def thanksgiving_week_flag(cls):
        """
        True if the record was captured during Thanksgiving Week
        """

        thanksgiving_start = pd.Timestamp('2024-11-25')  # Monday
        if cls.date_completed is None or pd.isna(cls.date_completed):
            return False  # or handle as needed
        if thanksgiving_start <= cls.date_completed:
            return True
        else:
            return False



    weight: float = Field(
        ..., description = 'Default expansion Factor of the observation, used in expansion script downstream'
    )
    """
    Default expansion Factor of the observation, used in the expansion script downstream
    """

    weight_departing_and_arriving: float = Field(
        ..., description = 'Weights corresponding to arriving and departing passengers expansion (also includes synthetic records)'
    )
    """
    Weights corresponding to arriving and departing expansion (also includes synthetic records)
    """

    weight_departing_only: float = Field(
        ..., description = 'Weights corresponding to only departing passengers expansion (no synthetic/arriving passengers)'
    )
    """
    Weights corresponding to only departing passengers expansion (no synthetic/arriving passengers)
    """

    weight_non_sas_departing_only: float = Field(
        ..., description = 'Weights corresponding to only departing and intercept survey passengers expansion (no self-administered survey responses, or synthetic records)'
    )
    """
    Weights corresponding to only departing and intercept survey passengers expansion (no self-administered survey responses or synthetic records)
    """


    weight_departing_only_with_time_of_day: float = Field(
        ..., description = 'Weights corresponding to only departing passengers expansion including time-of-day controls (no synthetic/arriving passengers)'
    )
    """
    Weights corresponding to only departing passengers expansion including time-of-day controls (no synthetic/arriving passengers)
    """


    interview_location: NoneOrNan[e.InterviewLocation] = Field(
        ..., description = "Location where respondent was intercepted")
    """
    Location where respondent was intercepted.
    """

    interview_location_other: NoneOrNanString[str] = Field(
        ..., description = "Other Location where respondent was intercepted")
    """
    Other Location where respondent was intercepted
    """

    marketsegment: NoneOrNan[e.Type] = Field(
        ..., description="Type of respondent, either passenger, employee, or other"
    )
    """
    Type of respondent, either passenger, employee, or other.
    """

    resident_visitor_purpose: NoneOrNanString[e.ResidentVisitorPurpose] = Field(
        ..., description = "Determines the resident/visitor classification based on the home airport status and flight purpose"
    )
    """
    Determines the resident/visitor classification based on the home airport status and flight purpose
    """

    is_qualified_age: NoneOrNanString[bool] = Field(
        ...,
        description="Whether the respondent is of a qualified age to participate in the survey",
    )
    """
    Whether the respondent is of a qualified age to participate in the survey.
    """

    resident_visitor: NoneOrNan[e.ResidentVisitor] = Field(
        ...,
        description="Where the respondent resides in the airport service area most of the year",
    )
    """
    Where the respondent resides in the airport service area most of the year.
    """

    home_location_place_name: NoneOrNanString[str] =  Field(
        ..., description = "Postal City of the home location of the respondent"
    )
    """
    Postal City of the home location of the respondent
    """

    home_location_state: NoneOrNanString[str] =  Field(
        ..., description = "State of the home location of the respondent"
    )
    """
    State of the home location of the respondent
    """

    home_location_zip: NoneOrNanString[Union[str,int]] =  Field(
        ..., description = "ZIP of the home location of the respondent"
    )
    """
    ZIP of the home location of the respondent
    """

    home_location_latitude: NoneOrNanString[Latitude] =  Field(
        ..., description = "Latitude of the home location of the respondent"
    )
    """
    Latitude of the home location of the respondent
    """

    home_location_longitude: NoneOrNanString[Longitude]=   Field(
        ..., description = "Longitude of the home location of the respondent"
    )
    """
    Longitude of the home location of the respondent
    """

    home_location_municipal_zone: NoneOrNanString[str] = Field(
        ..., description="Municipal zone of home address of the respondent"
    )
    """
    Municipal zone of home address of the Resident
    """

    home_location_pmsa: NoneOrNanString[e.PMSA] = Field(
        ..., description="Pseudo MSA of home address of the Resident"
    )
    """
    Pseudo MSA of home address of the Resident
    """

    number_of_travel_companions: NoneOrNanString[e.PartySize] = Field(
        ..., description = "Number of people flying with the respondent (count excludes the respondent)"
    )
    """
    Number of people flying with the respondent (count excludes the respondent)
    """

    party_size_flight: NoneOrNan[int] = Field(
        ..., description = "Size of the travel party"
    )
    """
    Size of the travel party
    """
 #Add new here
    # home_location_address: NoneOrNanString[str] =  Field(
    #     ..., description = "Street Address of the home location of the respondent"
    # )
    # """
    # Street Address of the home location of the respondent
    # """

    age: NoneOrNan[e.Age] = Field(..., description="Age category of the respondent")
    """
    Age category of the respondent.
    """

    gender: NoneOrNan[e.Gender] = Field(..., description="Gender of the respondent")
    """
    Gender of the respondent.
    """

    gender_other: NoneOrNanString[str] = Field(
        ..., description = "Gender of the respondent (not listed)"
    )
    """
    Gender of the respondent (not listed)
    """

    race_aian: NoneOrNanString[bool] = Field(
        ...,
        description="Does the respondent identify as American Indian or Alaska Native?",
    )
    """
    Does the respondent identify as American Indian or Alaska Native?
    """

    race_asian:  NoneOrNanString[bool] = Field(..., description="Does the respondent identify as Asian?")
    """
    Does the respondent identify as Asian?
    """

    race_black:  NoneOrNanString[bool] = Field(
        ..., description="Does the respondent identify as Black or African American?"
    )
    """
    Does the respondent identify as Black or African American?
    """

    race_hispanic:  NoneOrNanString[bool] = Field(
        ..., description="Does the respondent identify as Hispanic or Latino?"
    )
    """
    Does the respondent identify as Hispanic or Latino?
    """

    race_middle_eastern:  NoneOrNanString[bool] = Field(
        ..., description="Does the respondent identify as Middle Eastern?"
    )
    """
    Does the respondent identify as Middle Eastern?
    """

    race_hp:  NoneOrNanString[bool] = Field(
        ...,
        description="Does the respondent identify as Native Hawaiian or Other Pacific Islander?",
    )
    """
    Does the respondent identify as Native Hawaiian or Other Pacific Islander?
    """

    race_white:  NoneOrNanString[bool] = Field(..., description="Does the respondent identify as White?")
    """
    Does the respondent identify as White?
    """

    race_unknown:  NoneOrNanString[bool] = Field(
        ..., description="Does the respondent identify as an unknown"
    )
    """
    Does the respondent identify as an unknown race/ethnicity?
    """

    race_other: NoneOrNanString[str] = Field(
        ...,
        description="If the respondent enters a race/ethnicicy not listed above, this field will be populated",
    )
    """
    If the respondent enters a race/ethnicity not listed above, this field will be populated. 
    """

    race_list: NoneOrNanString[str] = Field(
        ...,
        description="List of Races the respondent identifies as (comma separated)",
    )
    """
    List of Races the respondent identifies as (comma separated)
    """

    number_persons_in_household: NoneOrNan[e.HouseholdSize] = Field(
        ..., description="Number of persons in the respondent's household"
    )
    """
    Number of persons in the respondent's household.
    """

    number_vehicles: NoneOrNan[e.HouseholdVehicles] = Field(
        ..., description="Number of vehicles in the respondent's household"
    )
    """
    Number of vehicles in the respondent's household.
    """

    household_income: NoneOrNan[e.HouseholdIncome] = Field(
        ..., description="Income range of the respondent's household"
    )
    """
    Income range of the respondent's household.
    """

    is_income_below_poverty: NoneOrNanString[e.YesNoType] = Field(
        ..., description="Is the respondent's household income below poverty?",
    )
    """
    Is the respondent's household income below poverty?
    """

    number_workers: NoneOrNan[e.HouseholdWorkers] = Field(
        ..., description="Number of workers in the respondent's household"
    )
    """
    Number of workers in the respondent's household.
    """

    sp_invitation: NoneOrNanString[e.YesNoType] = Field(
        ..., description = "Whether the respondent chose to participate in the SP Survey"
    )

    """
    Whether the respondent chose to participate in the SP Survey
    """

    stay_informed: NoneOrNanString[e.YesNoType] = Field(
        ..., description = "Whether the respondent chose to Stay Informed about the project"
    )

    """
    Whether the respondent chose to Stay Informed about the project
    """

    survey_language: NoneOrNanString[e.SurveyLanguage] = Field(
        ..., description = "Language of the Survey"
    )
    """
    Language of the Survey
    """

    survey_language_other: NoneOrNanString[str] =  Field(
        ..., description = "Other (not listed) language of the survey"
    )
    """
    Other (not listed) language of the survey
    """
    ##Add SP Fields:

    sp_feature_short_wait: NoneOrNan[e.SPImportance] = Field(
        ..., description="Level of importance assigned to having a short wait time (less than 10 minutes) for transit service."
    )
    """Level of importance assigned to having a short wait time (less than 10 minutes) for transit service."""

    sp_feature_seats_transit_stop: NoneOrNan[e.SPImportance] = Field(
        ..., description="Level of importance assigned to the availability of seats at the transit stop."
    )
    """Level of importance assigned to the availability of seats at the transit stop."""

    sp_feature_luggage_rack: NoneOrNan[e.SPImportance] = Field(
        ..., description="Level of importance assigned to having a luggage rack option on the transit service."
    )
    """Level of importance assigned to having a luggage rack option on the transit service."""

    sp_feature_seats_transit: NoneOrNan[e.SPImportance] = Field(
        ..., description="Level of importance assigned to having available seating on the transit vehicle."
    )
    """Level of importance assigned to having available seating on the transit vehicle."""

    sp_feature_no_delay: NoneOrNan[e.SPImportance] = Field(
        ..., description="Level of importance assigned to ensuring the transit service is not delayed by car traffic."
    )
    """Level of importance assigned to ensuring the transit service is not delayed by car traffic."""

    sp_feature_early_morning: NoneOrNan[e.SPImportance] = Field(
        ..., description="Level of importance assigned to the service starting early in the morning (before 5 AM)."
    )
    """Level of importance assigned to the service starting early in the morning (before 5 AM)."""

    sp_feature_late_night: NoneOrNan[e.SPImportance] = Field(
        ..., description="Level of importance assigned to the service operating past 10 PM."
    )
    """Level of importance assigned to the service operating past 10 PM."""

    sp_feature_weekend_frequency: NoneOrNan[e.SPImportance] = Field(
        ..., description="Level of importance assigned to frequent transit service availability on weekends."
    )
    """Level of importance assigned to frequent transit service availability on weekends."""

    sp_access_walk_time: NoneOrNan[e.SPWillingToWalkTime] = Field(
        ..., description="Maximum walking time (in minutes) the respondent is willing to take to access the transit station."
    )
    """Maximum walking time (in minutes) the respondent is willing to take to access the transit station."""

    sp_number_of_transfers: NoneOrNan[e.SPNumTransfers] = Field(
        ..., description="Number of transfers the respondent is willing to make to reach the airport."
    )
    """Number of transfers the respondent is willing to make to reach the airport."""

    sp_dropoff_escort: NoneOrNan[e.SPDropoffType] = Field(
        ..., description="Type of Person who dropped the respondent off at the airport."
    )
    """Type of Person who dropped the respondent off at the airport."""

    sp_dropoff_choice_no_transit_access: NoneOrNan[e.SPLikelihood] = Field(
        ..., description="Likelihood of being dropped off at the new transit station in areas without existing transit access."
    )
    """Likelihood of being dropped off at the new transit station in areas without existing transit access."""

    sp_dropoff_choice_transit_access: NoneOrNan[e.SPLikelihood] = Field(
        ..., description="Likelihood of being dropped off at a transit stop in areas with existing transit access."
    )
    """Likelihood of being dropped off at a transit stop in areas with existing transit access."""

    sp_taxi_choice_dropoff_station: NoneOrNan[e.SPLikelihood] = Field(
        ..., description="Likelihood of opting for drop-off at the new transit station when using a taxi."
    )
    """Likelihood of opting for drop-off at the new transit station when using a taxi."""

    sp_rental_choice_no_transit: NoneOrNan[e.SPLikelihood] = Field(
        ..., description="Likelihood of still renting a car if the new transit service were available."
    )
    """Likelihood of still renting a car if the new transit service were available."""

    sp_connection_to_santafe_depot: NoneOrNan[e.SPLikelihood] = Field(
        ..., description="Likelihood of using the new transit connection to the Santa Fe Depot train station."
    )
    """Likelihood of using the new transit connection to the Santa Fe Depot train station."""

    sp_connection_to_convention_center: NoneOrNan[e.SPLikelihood] = Field(
        ..., description="Likelihood of using the new transit connection to the San Diego Convention Center."
    )
    """Likelihood of using the new transit connection to the San Diego Convention Center."""

    sp_connection_to_old_town_center: NoneOrNan[e.SPLikelihood] = Field(
        ..., description="Likelihood of using the new transit connection to the Old Town Transit Center."
    )
    """Likelihood of using the new transit connection to the Old Town Transit Center."""

     # Missing fields related to other airports
    sp_other_airport_ease_of_planning: NoneOrNanString[bool] = Field(
        ..., description="True if the respondent found trip planning easy at another airport's transit service."
    )
    """True if the respondent found trip planning easy at another airport's transit service."""

    sp_other_airport_walking_distance: NoneOrNanString[bool] = Field(
        ..., description="True if the transit station at another airport was within a comfortable walking distance."
    )
    """True if the transit station at another airport was within a comfortable walking distance."""

    sp_other_airport_short_travel_time: NoneOrNanString[bool] = Field(
        ..., description="True if the respondent experienced a short total travel time at another airport."
    )
    """True if the respondent experienced a short total travel time at another airport."""

    sp_other_airport_no_delays: NoneOrNanString[bool] = Field(
        ..., description="True if the respondent experienced no delays using another airport's transit service."
    )
    """True if the respondent experienced no delays using another airport's transit service."""

    sp_other_airport_cost: NoneOrNanString[bool] = Field(
        ..., description="True if the cost of using transit at another airport was a positive factor."
    )
    """True if the cost of using transit at another airport was a positive factor."""

    sp_other_airport_frequency_of_service: NoneOrNanString[bool] = Field(   
        ..., description="True if the frequency of service at another airport was a positive factor."
    )
    """
    True if the frequency of service at another airport was a positive factor.
    """

    sp_other_airport_ease_of_boarding: NoneOrNanString[bool] = Field(
        ..., description="True if the respondent found boarding easy at another airport's transit service."
    )
    """True if the respondent found boarding easy at another airport's transit service."""

    sp_other_airport_comfort: NoneOrNanString[bool] = Field(
        ..., description="True if the respondent found the transit service at another airport comfortable."
    )
    """True if the respondent found the transit service at another airport comfortable."""

    sp_other_airport_safety: NoneOrNanString[bool] = Field(
        ..., description="True if the respondent felt safe using another airport's transit service."
    )
    """True if the respondent felt safe using another airport's transit service."""

    sp_other_airport_luggage_rack: NoneOrNanString[bool] = Field(
        ..., description="True if a luggage rack was available at another airport's transit service."
    )
    """True if a luggage rack was available at another airport's transit service."""

    sp_other_airport_enough_capacity: NoneOrNanString[bool] = Field(
        ..., description="True if there was sufficient passenger capacity at another airport."
    )
    """True if there was sufficient passenger capacity at another airport."""

    sp_other_airport_no_transfers: NoneOrNanString[bool] = Field(
        ..., description="True if no transfers were required at another airport's transit service."
    )
    """True if no transfers were required at another airport's transit service."""

    sp_other_airport_longer_operating_hours: NoneOrNanString[bool] = Field(
        ..., description="True if another airport's transit service had longer operating hours."
    )
    """True if another airport's transit service had longer operating hours."""

    sp_other_airport_enough_room_to_stand: NoneOrNanString[bool] = Field(
        ..., description="True if there was enough standing room at another airport's transit service."
    )
    """True if there was enough standing room at another airport's transit service."""

    sp_other_airport_enough_seats: NoneOrNanString[bool] = Field(
        ..., description="True if there were enough available seats at another airport's transit service."
    )
    """True if there were enough available seats at another airport's transit service."""

    sp_other_airport_other_specify: NoneOrNanString[bool] = Field(
        ..., description="True if the respondent liked something else about another airport’s transit service."
    )
    """True if the respondent liked something else about another airport’s transit service."""

    sp_other_airport_did_not_like: NoneOrNanString[bool] = Field(
        ..., description="True if the respondent did not like the transit service at another airport."
    )
    """True if the respondent did not like the transit service at another airport."""


    sp_other_airport_other: NoneOrNanString[str] = Field(
        ..., description="Additional comments provided by the respondent regarding another airport's transit service."
    )
    """Additional comments provided by the respondent regarding another airport's transit service."""

    sp_other_airport_list: NoneOrNanString[str] = Field(
        ..., description="List of factors at other airports due to which the respondent used transit service."
    )
    """
    List of factors at other airports due to which the respondent used transit service.
    """

    trip: Trip = Field(..., description="Details of the trip taken by the respondent")
    """
    Details of the trip taken by the respondent.
    """

    @model_validator(mode="after")
    def prefer_not_disclose_is_unique(cls, values):
        race_unknown = values.race_unknown
        race_aian = values.race_aian
        race_asian = values.race_asian
        race_black = values.race_black
        race_hispanic = values.race_hispanic
        race_middle_eastern = values.race_middle_eastern
        race_white = values.race_white
        if race_unknown and (
            race_aian
            or race_asian
            or race_black
            or race_hispanic
            or race_middle_eastern
            or race_white
        ):
            #values.race_unknown = False
            #values.valid_record= False
            values.validation_error = "Prefer Not to disclose cannot be combined with any other race"
            values.validation_severity = "Low"
        return values

age = Field(..., description='Age category of the respondent') class-attribute instance-attribute

Age category of the respondent.

date_completed = Field(..., description='Date when respondent completed the survey') class-attribute instance-attribute

Date when respondent completed the survey

gender = Field(..., description='Gender of the respondent') class-attribute instance-attribute

Gender of the respondent.

gender_other = Field(..., description='Gender of the respondent (not listed)') class-attribute instance-attribute

Gender of the respondent (not listed)

home_location_latitude = Field(..., description='Latitude of the home location of the respondent') class-attribute instance-attribute

Latitude of the home location of the respondent

home_location_longitude = Field(..., description='Longitude of the home location of the respondent') class-attribute instance-attribute

Longitude of the home location of the respondent

home_location_municipal_zone = Field(..., description='Municipal zone of home address of the respondent') class-attribute instance-attribute

Municipal zone of home address of the Resident

home_location_place_name = Field(..., description='Postal City of the home location of the respondent') class-attribute instance-attribute

Postal City of the home location of the respondent

home_location_pmsa = Field(..., description='Pseudo MSA of home address of the Resident') class-attribute instance-attribute

Pseudo MSA of home address of the Resident

home_location_state = Field(..., description='State of the home location of the respondent') class-attribute instance-attribute

State of the home location of the respondent

home_location_zip = Field(..., description='ZIP of the home location of the respondent') class-attribute instance-attribute

ZIP of the home location of the respondent

household_income = Field(..., description="Income range of the respondent's household") class-attribute instance-attribute

Income range of the respondent’s household.

initial_etc_check = Field(..., description="True if the record passed ETC's initial check") class-attribute instance-attribute

True if the record is to be used for submittal

interview_location = Field(..., description='Location where respondent was intercepted') class-attribute instance-attribute

Location where respondent was intercepted.

interview_location_other = Field(..., description='Other Location where respondent was intercepted') class-attribute instance-attribute

Other Location where respondent was intercepted

is_completed = Field(..., description='True if the record is complete') class-attribute instance-attribute

True if the record is complete

is_income_below_poverty = Field(..., description="Is the respondent's household income below poverty?") class-attribute instance-attribute

Is the respondent’s household income below poverty?

is_pilot = Field(..., description='True if the record was collected during the pilot survey') class-attribute instance-attribute

True if the record was collected during the pilot survey

is_qualified_age = Field(..., description='Whether the respondent is of a qualified age to participate in the survey') class-attribute instance-attribute

Whether the respondent is of a qualified age to participate in the survey.

is_self_administered = Field(default=False, description='True if the survey was self-administered by the respondent') class-attribute instance-attribute

True if the survey was self-administered by the respondent.

marketsegment = Field(..., description='Type of respondent, either passenger, employee, or other') class-attribute instance-attribute

Type of respondent, either passenger, employee, or other.

number_of_travel_companions = Field(..., description='Number of people flying with the respondent (count excludes the respondent)') class-attribute instance-attribute

Number of people flying with the respondent (count excludes the respondent)

number_persons_in_household = Field(..., description="Number of persons in the respondent's household") class-attribute instance-attribute

Number of persons in the respondent’s household.

number_vehicles = Field(..., description="Number of vehicles in the respondent's household") class-attribute instance-attribute

Number of vehicles in the respondent’s household.

number_workers = Field(..., description="Number of workers in the respondent's household") class-attribute instance-attribute

Number of workers in the respondent’s household.

party_size_flight = Field(..., description='Size of the travel party') class-attribute instance-attribute

Size of the travel party

race_aian = Field(..., description='Does the respondent identify as American Indian or Alaska Native?') class-attribute instance-attribute

Does the respondent identify as American Indian or Alaska Native?

race_asian = Field(..., description='Does the respondent identify as Asian?') class-attribute instance-attribute

Does the respondent identify as Asian?

race_black = Field(..., description='Does the respondent identify as Black or African American?') class-attribute instance-attribute

Does the respondent identify as Black or African American?

race_hispanic = Field(..., description='Does the respondent identify as Hispanic or Latino?') class-attribute instance-attribute

Does the respondent identify as Hispanic or Latino?

race_hp = Field(..., description='Does the respondent identify as Native Hawaiian or Other Pacific Islander?') class-attribute instance-attribute

Does the respondent identify as Native Hawaiian or Other Pacific Islander?

race_list = Field(..., description='List of Races the respondent identifies as (comma separated)') class-attribute instance-attribute

List of Races the respondent identifies as (comma separated)

race_middle_eastern = Field(..., description='Does the respondent identify as Middle Eastern?') class-attribute instance-attribute

Does the respondent identify as Middle Eastern?

race_other = Field(..., description='If the respondent enters a race/ethnicicy not listed above, this field will be populated') class-attribute instance-attribute

If the respondent enters a race/ethnicity not listed above, this field will be populated.

race_unknown = Field(..., description='Does the respondent identify as an unknown') class-attribute instance-attribute

Does the respondent identify as an unknown race/ethnicity?

race_white = Field(..., description='Does the respondent identify as White?') class-attribute instance-attribute

Does the respondent identify as White?

record_type_synthetic = Field(..., description='True if the record is synthetically generated') class-attribute instance-attribute

True if the record is synthetically generated

resident_visitor = Field(..., description='Where the respondent resides in the airport service area most of the year') class-attribute instance-attribute

Where the respondent resides in the airport service area most of the year.

resident_visitor_purpose = Field(..., description='Determines the resident/visitor classification based on the home airport status and flight purpose') class-attribute instance-attribute

Determines the resident/visitor classification based on the home airport status and flight purpose

respondentid = Field(..., description='Unique identifier for the respondent') class-attribute instance-attribute

Unique identifier for the respondent.

sp_access_walk_time = Field(..., description='Maximum walking time (in minutes) the respondent is willing to take to access the transit station.') class-attribute instance-attribute

Maximum walking time (in minutes) the respondent is willing to take to access the transit station.

sp_connection_to_convention_center = Field(..., description='Likelihood of using the new transit connection to the San Diego Convention Center.') class-attribute instance-attribute

Likelihood of using the new transit connection to the San Diego Convention Center.

sp_connection_to_old_town_center = Field(..., description='Likelihood of using the new transit connection to the Old Town Transit Center.') class-attribute instance-attribute

Likelihood of using the new transit connection to the Old Town Transit Center.

sp_connection_to_santafe_depot = Field(..., description='Likelihood of using the new transit connection to the Santa Fe Depot train station.') class-attribute instance-attribute

Likelihood of using the new transit connection to the Santa Fe Depot train station.

sp_dropoff_choice_no_transit_access = Field(..., description='Likelihood of being dropped off at the new transit station in areas without existing transit access.') class-attribute instance-attribute

Likelihood of being dropped off at the new transit station in areas without existing transit access.

sp_dropoff_choice_transit_access = Field(..., description='Likelihood of being dropped off at a transit stop in areas with existing transit access.') class-attribute instance-attribute

Likelihood of being dropped off at a transit stop in areas with existing transit access.

sp_dropoff_escort = Field(..., description='Type of Person who dropped the respondent off at the airport.') class-attribute instance-attribute

Type of Person who dropped the respondent off at the airport.

sp_feature_early_morning = Field(..., description='Level of importance assigned to the service starting early in the morning (before 5 AM).') class-attribute instance-attribute

Level of importance assigned to the service starting early in the morning (before 5 AM).

sp_feature_late_night = Field(..., description='Level of importance assigned to the service operating past 10 PM.') class-attribute instance-attribute

Level of importance assigned to the service operating past 10 PM.

sp_feature_luggage_rack = Field(..., description='Level of importance assigned to having a luggage rack option on the transit service.') class-attribute instance-attribute

Level of importance assigned to having a luggage rack option on the transit service.

sp_feature_no_delay = Field(..., description='Level of importance assigned to ensuring the transit service is not delayed by car traffic.') class-attribute instance-attribute

Level of importance assigned to ensuring the transit service is not delayed by car traffic.

sp_feature_seats_transit = Field(..., description='Level of importance assigned to having available seating on the transit vehicle.') class-attribute instance-attribute

Level of importance assigned to having available seating on the transit vehicle.

sp_feature_seats_transit_stop = Field(..., description='Level of importance assigned to the availability of seats at the transit stop.') class-attribute instance-attribute

Level of importance assigned to the availability of seats at the transit stop.

sp_feature_short_wait = Field(..., description='Level of importance assigned to having a short wait time (less than 10 minutes) for transit service.') class-attribute instance-attribute

Level of importance assigned to having a short wait time (less than 10 minutes) for transit service.

sp_feature_weekend_frequency = Field(..., description='Level of importance assigned to frequent transit service availability on weekends.') class-attribute instance-attribute

Level of importance assigned to frequent transit service availability on weekends.

sp_invitation = Field(..., description='Whether the respondent chose to participate in the SP Survey') class-attribute instance-attribute

Whether the respondent chose to participate in the SP Survey

sp_number_of_transfers = Field(..., description='Number of transfers the respondent is willing to make to reach the airport.') class-attribute instance-attribute

Number of transfers the respondent is willing to make to reach the airport.

sp_other_airport_comfort = Field(..., description='True if the respondent found the transit service at another airport comfortable.') class-attribute instance-attribute

True if the respondent found the transit service at another airport comfortable.

sp_other_airport_cost = Field(..., description='True if the cost of using transit at another airport was a positive factor.') class-attribute instance-attribute

True if the cost of using transit at another airport was a positive factor.

sp_other_airport_did_not_like = Field(..., description='True if the respondent did not like the transit service at another airport.') class-attribute instance-attribute

True if the respondent did not like the transit service at another airport.

sp_other_airport_ease_of_boarding = Field(..., description="True if the respondent found boarding easy at another airport's transit service.") class-attribute instance-attribute

True if the respondent found boarding easy at another airport’s transit service.

sp_other_airport_ease_of_planning = Field(..., description="True if the respondent found trip planning easy at another airport's transit service.") class-attribute instance-attribute

True if the respondent found trip planning easy at another airport’s transit service.

sp_other_airport_enough_capacity = Field(..., description='True if there was sufficient passenger capacity at another airport.') class-attribute instance-attribute

True if there was sufficient passenger capacity at another airport.

sp_other_airport_enough_room_to_stand = Field(..., description="True if there was enough standing room at another airport's transit service.") class-attribute instance-attribute

True if there was enough standing room at another airport’s transit service.

sp_other_airport_enough_seats = Field(..., description="True if there were enough available seats at another airport's transit service.") class-attribute instance-attribute

True if there were enough available seats at another airport’s transit service.

sp_other_airport_frequency_of_service = Field(..., description='True if the frequency of service at another airport was a positive factor.') class-attribute instance-attribute

True if the frequency of service at another airport was a positive factor.

sp_other_airport_list = Field(..., description='List of factors at other airports due to which the respondent used transit service.') class-attribute instance-attribute

List of factors at other airports due to which the respondent used transit service.

sp_other_airport_longer_operating_hours = Field(..., description="True if another airport's transit service had longer operating hours.") class-attribute instance-attribute

True if another airport’s transit service had longer operating hours.

sp_other_airport_luggage_rack = Field(..., description="True if a luggage rack was available at another airport's transit service.") class-attribute instance-attribute

True if a luggage rack was available at another airport’s transit service.

sp_other_airport_no_delays = Field(..., description="True if the respondent experienced no delays using another airport's transit service.") class-attribute instance-attribute

True if the respondent experienced no delays using another airport’s transit service.

sp_other_airport_no_transfers = Field(..., description="True if no transfers were required at another airport's transit service.") class-attribute instance-attribute

True if no transfers were required at another airport’s transit service.

sp_other_airport_other = Field(..., description="Additional comments provided by the respondent regarding another airport's transit service.") class-attribute instance-attribute

Additional comments provided by the respondent regarding another airport’s transit service.

sp_other_airport_other_specify = Field(..., description='True if the respondent liked something else about another airport’s transit service.') class-attribute instance-attribute

True if the respondent liked something else about another airport’s transit service.

sp_other_airport_safety = Field(..., description="True if the respondent felt safe using another airport's transit service.") class-attribute instance-attribute

True if the respondent felt safe using another airport’s transit service.

sp_other_airport_short_travel_time = Field(..., description='True if the respondent experienced a short total travel time at another airport.') class-attribute instance-attribute

True if the respondent experienced a short total travel time at another airport.

sp_other_airport_walking_distance = Field(..., description='True if the transit station at another airport was within a comfortable walking distance.') class-attribute instance-attribute

True if the transit station at another airport was within a comfortable walking distance.

sp_rental_choice_no_transit = Field(..., description='Likelihood of still renting a car if the new transit service were available.') class-attribute instance-attribute

Likelihood of still renting a car if the new transit service were available.

sp_taxi_choice_dropoff_station = Field(..., description='Likelihood of opting for drop-off at the new transit station when using a taxi.') class-attribute instance-attribute

Likelihood of opting for drop-off at the new transit station when using a taxi.

stay_informed = Field(..., description='Whether the respondent chose to Stay Informed about the project') class-attribute instance-attribute

Whether the respondent chose to Stay Informed about the project

survey_language = Field(..., description='Language of the Survey') class-attribute instance-attribute

Language of the Survey

survey_language_other = Field(..., description='Other (not listed) language of the survey') class-attribute instance-attribute

Other (not listed) language of the survey

thanksgiving_week_flag property

True if the record was captured during Thanksgiving Week

time_completed = Field(..., description='Time when respondent completed the survey') class-attribute instance-attribute

Time when respondent completed the survey

trip = Field(..., description='Details of the trip taken by the respondent') class-attribute instance-attribute

Details of the trip taken by the respondent.

weight = Field(..., description='Default expansion Factor of the observation, used in expansion script downstream') class-attribute instance-attribute

Default expansion Factor of the observation, used in the expansion script downstream

weight_departing_and_arriving = Field(..., description='Weights corresponding to arriving and departing passengers expansion (also includes synthetic records)') class-attribute instance-attribute

Weights corresponding to arriving and departing expansion (also includes synthetic records)

weight_departing_only = Field(..., description='Weights corresponding to only departing passengers expansion (no synthetic/arriving passengers)') class-attribute instance-attribute

Weights corresponding to only departing passengers expansion (no synthetic/arriving passengers)

weight_departing_only_with_time_of_day = Field(..., description='Weights corresponding to only departing passengers expansion including time-of-day controls (no synthetic/arriving passengers)') class-attribute instance-attribute

Weights corresponding to only departing passengers expansion including time-of-day controls (no synthetic/arriving passengers)

weight_non_sas_departing_only = Field(..., description='Weights corresponding to only departing and intercept survey passengers expansion (no self-administered survey responses, or synthetic records)') class-attribute instance-attribute

Weights corresponding to only departing and intercept survey passengers expansion (no self-administered survey responses or synthetic records)

SkipLogicValidator

Source code in data_model/data_model.py
 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
class SkipLogicValidator:
    def __init__(self, skip_logic_csv):
        self.rules = pd.read_csv(skip_logic_csv)

    def get_rules_for_class(self, class_name):
        """Filter skip logic rules for a specific class."""
        return self.rules[self.rules['class'] == class_name]

    def validate(self, class_name, data):
        """Validate data using skip logic rules for a specific class."""
        errors = []
        severity_levels = {"Non-Critical" : 0, "Critical": 0}  # Track severity levels

        rules = self.get_rules_for_class(class_name)

        for _, rule in rules.iterrows():
            # Extract rule details
            condition_variable = rule['condition_variable']
            condition_values = str(rule['condition_value']).split(',')  # Ensure it's a string before splitting
            check_type = rule['check_type']
            check_variables = rule['check_variables'].split(',')
            check_values = str(rule['check_values']).split(',') if pd.notna(rule['check_values']) else []
            severity = rule['severity']

            # Perform validation based on check_type
            if check_type == "critical":
                # Check fields directly for missing values
                if self.perform_critical_check(data, check_variables):
                    errors.append(f"{', '.join(check_variables)}: {severity}")
                    severity_levels[severity] += 1

            elif check_type == "missing":
                # Conditional validation allowing multiple condition values
                if condition_variable in data and str(data[condition_variable]) in condition_values:
                    if not self.perform_check(data, check_type, check_variables, check_values):
                        errors.append(f"{', '.join(check_variables)}: {severity}")
                        severity_levels[severity] += 1

            elif check_type == "value":
                # Perform a value check even if no condition_variable is given
                if not condition_variable or (condition_variable in data and str(data[condition_variable]) in condition_values):
                    if not self.perform_check(data, check_type, check_variables, check_values):
                        errors.append(f"{', '.join(check_variables)}: {severity}")
                        severity_levels[severity] += 1

        return errors, severity_levels, len(errors)

    def perform_critical_check(self, data, check_variables):
        """
        Check if any of the critical fields are missing.
        Returns True if any field is missing, False otherwise.
        """
        for var in check_variables:
            if var not in data or data[var] is None:
                # Log which variable failed the critical check
                print(f"Critical check failed for variable: {var}")
                return True  # A missing field causes the critical check to fail
        return False  # All fields are present

    def perform_check(self, data, check_type, check_variables, check_values):
        """Perform the validation check based on the check_type."""
        if check_type == "missing":
            # Return False if any of the variables are missing
            return all(var in data and data[var] is not None for var in check_variables)
        elif check_type == "value":
            # Return False if any of the variables do not match the expected values
            return all(var in data and data[var] in check_values for var in check_variables)
        return True

get_rules_for_class(class_name)

Filter skip logic rules for a specific class.

Source code in data_model/data_model.py
44
45
46
def get_rules_for_class(self, class_name):
    """Filter skip logic rules for a specific class."""
    return self.rules[self.rules['class'] == class_name]

perform_check(data, check_type, check_variables, check_values)

Perform the validation check based on the check_type.

Source code in data_model/data_model.py
 99
100
101
102
103
104
105
106
107
def perform_check(self, data, check_type, check_variables, check_values):
    """Perform the validation check based on the check_type."""
    if check_type == "missing":
        # Return False if any of the variables are missing
        return all(var in data and data[var] is not None for var in check_variables)
    elif check_type == "value":
        # Return False if any of the variables do not match the expected values
        return all(var in data and data[var] in check_values for var in check_variables)
    return True

perform_critical_check(data, check_variables)

Check if any of the critical fields are missing. Returns True if any field is missing, False otherwise.

Source code in data_model/data_model.py
87
88
89
90
91
92
93
94
95
96
97
def perform_critical_check(self, data, check_variables):
    """
    Check if any of the critical fields are missing.
    Returns True if any field is missing, False otherwise.
    """
    for var in check_variables:
        if var not in data or data[var] is None:
            # Log which variable failed the critical check
            print(f"Critical check failed for variable: {var}")
            return True  # A missing field causes the critical check to fail
    return False  # All fields are present

validate(class_name, data)

Validate data using skip logic rules for a specific class.

Source code in data_model/data_model.py
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
def validate(self, class_name, data):
    """Validate data using skip logic rules for a specific class."""
    errors = []
    severity_levels = {"Non-Critical" : 0, "Critical": 0}  # Track severity levels

    rules = self.get_rules_for_class(class_name)

    for _, rule in rules.iterrows():
        # Extract rule details
        condition_variable = rule['condition_variable']
        condition_values = str(rule['condition_value']).split(',')  # Ensure it's a string before splitting
        check_type = rule['check_type']
        check_variables = rule['check_variables'].split(',')
        check_values = str(rule['check_values']).split(',') if pd.notna(rule['check_values']) else []
        severity = rule['severity']

        # Perform validation based on check_type
        if check_type == "critical":
            # Check fields directly for missing values
            if self.perform_critical_check(data, check_variables):
                errors.append(f"{', '.join(check_variables)}: {severity}")
                severity_levels[severity] += 1

        elif check_type == "missing":
            # Conditional validation allowing multiple condition values
            if condition_variable in data and str(data[condition_variable]) in condition_values:
                if not self.perform_check(data, check_type, check_variables, check_values):
                    errors.append(f"{', '.join(check_variables)}: {severity}")
                    severity_levels[severity] += 1

        elif check_type == "value":
            # Perform a value check even if no condition_variable is given
            if not condition_variable or (condition_variable in data and str(data[condition_variable]) in condition_values):
                if not self.perform_check(data, check_type, check_variables, check_values):
                    errors.append(f"{', '.join(check_variables)}: {severity}")
                    severity_levels[severity] += 1

    return errors, severity_levels, len(errors)

Trip

Bases: PydanticModel

Data model for a trip taken by a respondent.

Source code in data_model/data_model.py
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
class Trip(PydanticModel):
    """
    Data model for a trip taken by a respondent.
    """

    inbound_or_outbound: NoneOrNan[e.InboundOutbound] = Field(
        ...,
        description="Whether the trip is inbound to the airport or outbound from the airport",
    )
    """
    Whether the trip is inbound to the airport or outbound from the airport.
    """

    origin_activity_type: NoneOrNanString[e.ActivityType] = Field(
        ..., description="Activity type at the origin of the trip to the airport"
    )
    """
    Activity type at the origin of the trip to the airport.
    """

    origin_activity_type_other: NoneOrNanString[str] = Field(
        ..., description="Activity type at the origin of the trip to the airport"
    )
    """
    Activity type at the origin of the trip to the airport.

    """
    origin_name: NoneOrNanString[str] = Field(
        ..., description="Place name of the origin of the trip to the airport"
    )
    """
    Place name of the origin of the trip to the airport.
    """

    origin_place_name: NoneOrNanString[str] = Field(
        ..., description="Postal City of the origin address for the trip to the airport"
    )
    """
    Postal City of the origin address for the trip to the airport.
    """

    origin_state: NoneOrNanString[str] = Field(
        ..., description="State of the origin address for the trip to the airport"
    )
    """
    State of the origin address for the trip to the airport.
    """

    origin_zip: NoneOrNanString[Union[str, int]] = Field(
        ..., description="ZIP code of the origin address for the trip to the airport"
    )
    """
    ZIP code of the origin address for the trip to the airport.
    """

    origin_latitude: NoneOrNanString[Latitude] = Field(
        ..., description="Latitude coordinate of the origin address for the trip to the airport"
    )
    """
    Latitude coordinate of the origin address for the trip to the airport.
    """

    origin_longitude: NoneOrNanString[Longitude] = Field(
        ..., description="Longitude coordinate of the origin address for the trip to the airport"
    )
    """
    Longitude coordinate of the origin address for the trip to the airport.
    """

    origin_municipal_zone: NoneOrNanString[str] = Field(
        ..., description="Municipal zone of the origin address for the trip to the airport"
    )
    """
    Municipal zone of the origin address for the trip to the airport
    """

    origin_pmsa: NoneOrNanString[e.PMSA] = Field(
        ..., description="Pseudo MSA of the origin address for the trip to the airport"
    )
    """
    Pseudo MSA of the origin address for the trip to the airport
    """

    destination_activity_type: NoneOrNanString[e.ActivityType] = Field(
        ...,
        description="Activity type at the destination of the trip from the airport",
    )
    """
    Activity type at the destination of the trip from the airport.
    """

    destination_activity_type_other: NoneOrNanString[str] = Field(
        ...,
        description="Activity type (other) at the destination of the trip from the airport",
    )
    """
    Activity type (other) at the destination of the trip from the airport.
    """

    @computed_field(
        return_type = e.ActivityType,
        description="Activity type prior to traveling to the airport (for inbound) or activity traveling to do next (for outbound).",
    )
    @property
    def non_airport_activity_type(cls):
        """
        Activity type prior to traveling to the airport (for inbound) or activity traveling to do next (for outbound).
        """
        if cls.inbound_or_outbound == e.InboundOutbound.INBOUND_TO_AIRPORT:
            return cls.origin_activity_type
        return cls.destination_activity_type

    destination_name: NoneOrNanString[str] = Field(
    ..., description="Place name of the destination from the airport"
    )
    """
    Place name of the destination from the airport.
    """

    destination_place_name: NoneOrNanString[str] = Field(
        ..., description="Postal City of the destination address from the airport"
    )
    """
    Postal City of the destination address from the airport.
    """

    destination_state: NoneOrNanString[str] = Field(
        ..., description="State of the destination address from the airport"
    )
    """
    State of the destination address from the airport.
    """

    destination_zip: NoneOrNanString[Union[str, int]] = Field(
        ..., description="ZIP code of the destination address from the airport"
    )
    """
    ZIP code of the destination address from the airport.
    """

    destination_latitude: NoneOrNanString[Latitude] = Field(
        ..., description="Latitude coordinate of the destination address from the airport"
    )
    """
    Latitude coordinate of the destination address from the airport.
    """

    destination_longitude: NoneOrNanString[Longitude] = Field(
        ..., description="Longitude coordinate of the destination address from the airport"
    )
    """
    Longitude coordinate of the destination address from the airport.
    """

    destination_municipal_zone: NoneOrNanString[str] = Field(
        ..., description="Municipal zone of the destination address for the trip to the airport"
    )
    """
    Municipal zone of the destination address for the trip to the airport
    """

    destination_pmsa: NoneOrNanString[e.PMSA] = Field(
        ..., description="Pseudo MSA of the destination address for the trip to the airport"
    )
    """
    Pseudo MSA of the origin destination for the trip to the airport
    """

    main_transit_mode: NoneOrNanString[e.TravelMode] = Field(
        ..., description = "Main Transit mode to/from airport"
    )
    """
    Main Transit mode to/from airport.
    """

    main_mode: NoneOrNanString[e.TravelMode] = Field(
        ..., description = "Main Mode to/from airport"
    )
    """
    Main Mode to/from airport.
    """

    main_mode_other: NoneOrNanString[str] = Field(
        ..., description = "Name of the other Main Mode to/from airport"
    )
    """
    Name of the other Main Mode to/from airport.
    """

    main_mode_grouped: NoneOrNanString[e.TravelModeGrouped] = Field(
        ..., description = "Grouped Main Mode to/from airport")
    """
    Grouped Main Mode to/from airport
    """

    shared_van_other: NoneOrNanString[str] = Field(
        ..., description = "Name of the other shared van service used by respondent"
    )
    """
    Name of the other shared van service used by respondent.
    """

    number_transit_vehicles_to_airport: NoneOrNanString[e.NumTransfers] = Field(
        ..., description = "Number of transit transfers for the inbound trip to the airport"
    )
    """
    Number of transit transfers for the inbound trip to the airport
    """

    to_airport_transit_route_1: NoneOrNanString[str] = Field(
        ..., description="Name of the First Transit Route to the airport"
    )
    """
    Name of the First Transit Route to the airport
    """

    to_airport_transit_route_1_other: NoneOrNanString[str] = Field(
        ..., description="Other First Transit Route to the airport"
    )
    """
    Other First Transit Route to the airport
    """

    to_airport_transit_route_2: NoneOrNanString[str] = Field(
        ..., description="Name of the Second Transit Route to the airport"
    )
    """
    Name of the Second Transit Route to the airport
    """

    to_airport_transit_route_2_other: NoneOrNanString[str] = Field(
        ..., description="Other Second Transit Route to the airport"
    )
    """
    Other Second Transit Route to the airport
    """

    to_airport_transit_route_3: NoneOrNanString[str] = Field(
        ..., description="Name of the Third Transit Route to the airport"
    )
    """
    Name of the Third Transit Route to the airport
    """

    to_airport_transit_route_3_other: NoneOrNanString[str] = Field(
        ..., description="Other Third Transit Route to the airport"
    )
    """
    Other Third Transit Route to the airport
    """

    to_airport_transit_route_4: NoneOrNanString[str] = Field(
        ..., description="Name of the Fourth Transit Route to the airport"
    )
    """
    Name of the Fourth Transit Route to the airport
    """

    to_airport_transit_route_4_other: NoneOrNanString[str] = Field(
        ..., description="Other Fourth Transit Route to the airport"
    )
    """
    Other Fourth Transit Route to the airport
    """

    transit_routes_list: NoneOrNanString[str] = Field(
        ..., description = "List of transit routes used by the respondent (comma separated)"
    )
    """
    List of transit routes used by the respondent (comma separated)
    """

    num_transit_transfers: NoneOrNanString[int] = Field(
        ..., description = "Number of transit transfers made by the respondent"
    )
    """
    Number of transit transfers made by the respondent.
    """

    access_mode: NoneOrNanString[e.TravelMode] = Field(
        ..., description = "Access mode to first transit vehicle for inbound trip to the airport"
    )
    """
    Access mode to first transit vehicle for inbound trip to the airport.
    """

    access_mode_other: NoneOrNanString[str] = Field(
        ..., description = "Other Access mode to first transit vehicle for inbound trip to the airport"
    )
    """
    Other Access mode to first transit vehicle for inbound trip to the airport.
    """

    access_mode_grouped: NoneOrNanString[e.TravelModeGrouped] = Field(
        ..., description = "Grouped Access mode to first transit vehicle for inbound trip to the airport"
    )
    """
    Grouped Access mode to first transit vehicle for inbound trip to the airport.
    """

    taxi_fhv_fare: NoneOrNanString[Union[str,float]] = Field(
        ..., description = "Taxi or for-hire vehicle fare"
    )
    """
    Taxi or for-hire vehicle fare.
    """

    taxi_fhv_wait: NoneOrNanString[Union[str,float]] = Field(
        ..., description = "Wait time for taxi or for-hire vehicle"
    )
    """
    Wait time for taxi or for-hire vehicle.
    """

    parking_location: NoneOrNanString[e.ParkingLocation] = Field(
        ..., description = "Name of respondent's parking location. "
    )
    """
    Name of respondent's parking location. 
    """

    parking_location_other: NoneOrNanString[str] = Field(
        ..., description = "Name of respondent's (other) parking location. "
    )
    """
    Name of respondent's (other) parking location. 
    """

    parking_cost: NoneOrNanString[Union[str,float]] = Field(
        ..., description = "Amount respondent paid to park"
    )
    """
    Amount respondent paid to park.
    """

    @computed_field(
        return_type = float,
        description = "Numeric value of the taxi fare",
    )
    @property
    def taxi_fhv_fare_numeric(cls):
        """
        Numeric Value of Taxi Fare
        """
        if isinstance(cls.taxi_fhv_fare, str):
            numeric_value = re.findall(r"[-+]?\d*\.?\d+|\d+", cls.taxi_fhv_fare)
            return numeric_value[0] if numeric_value else None
        return cls.taxi_fhv_fare

    @computed_field(
        return_type = float,
        description = "Numeric value of the taxi Wait Time",
    )
    @property
    def taxi_fhv_wait_numeric(cls):
        """
        Numeric Value of Taxi Wait Time
        """
        if isinstance(cls.taxi_fhv_wait, str):
            numeric_value = re.findall(r"[-+]?\d*\.?\d+|\d+", cls.taxi_fhv_wait)
            return numeric_value[0] if numeric_value else None
        return cls.taxi_fhv_wait

    @computed_field(
        return_type = float,
        description = "Numeric value of parking cost",
    )
    @property
    def parking_cost_numeric(cls):
        """
        Numeric Value of parking cost
        """
        if isinstance(cls.parking_cost, str):
            numeric_value = re.findall(r"[-+]?\d*\.?\d+|\d+", cls.parking_cost)
            return numeric_value[0] if numeric_value else None
        return cls.parking_cost


    # @model_validator(mode="before")
    # def convert_datetime(cls, values):
    #     # List of fields to validate
    #     fields_to_check = ['taxi_fhv_fare', 'taxi_fhv_wait', 'parking_cost']

    #     for field in fields_to_check:
    #         value = values.get(field)
    #         if isinstance(value, datetime):
    #             # Option 1: Convert datetime to float (timestamp)
    #             # values[field] = value.timestamp()

    #             # Option 2: Convert datetime to a formatted string
    #             values[field] = value.strftime('%Y-%m-%d %H:%M:%S')
    #             values['valid_record'] = False
    #             values['validation_severity'] = "Low"
    #             values['validation_error'] = field + f"{field} is datetime"

    #     return values


    parking_cost_frequency: NoneOrNan[e.ParkingCostFrequency] = Field(
        ..., description = "Frequency of reported parking cost (e.g., one-time, per hour, per day, per month)"
    )
    """
    Frequency of reported parking cost (e.g., one-time, per hour, per day, per month)
    """

    parking_cost_frequency_other: NoneOrNanString[Union[str, int]] = Field(
        ..., description = "Other frequency of reported parking cost"
    )
    """
    Other frequency of reported parking cost
    """

    reimbursement: NoneOrNan[e.ParkingReimbursement] = Field(
        ..., description = "Whether or not ground access cost will be reimbursed by employer or other non-household member"
    )
    """
    Whether or not ground access cost will be reimbursed by employer or other non-household member.
    """

    number_transit_vehicles_from_airport: NoneOrNanString[e.NumTransfers] = Field(
        ..., description = "Number of transit transfers for the inbound trip"
    )
    """
    Number of transit transfers for the inbound trip.
    """

    from_airport_transit_route_1: NoneOrNanString[str] = Field(
        ..., description="Name of the First Transit Route from the airport"
    )
    """
    Name of the First Transit Route from the airport
    """

    from_airport_transit_route_1_other: NoneOrNanString[str] = Field(
        ..., description="Other First Transit Route from the airport"
    )
    """
    Other First Transit Route from the airport
    """

    from_airport_transit_route_2: NoneOrNanString[str] = Field(
        ..., description="Name of the Second Transit Route from the airport"
    )
    """
    Name of the Second Transit Route from the airport
    """

    from_airport_transit_route_2_other: NoneOrNanString[str] = Field(
        ..., description="Other Second Transit Route from the airport"
    )
    """
    Other Second Transit Route from the airport
    """

    from_airport_transit_route_3: NoneOrNanString[str] = Field(
        ..., description="Name of the Third Transit Route from the airport"
    )
    """
    Name of the Third Transit Route from the airport
    """

    from_airport_transit_route_3_other: NoneOrNanString[str] = Field(
        ..., description="Other Third Transit Route from the airport"
    )
    """
    Other Third Transit Route from the airport
    """

    from_airport_transit_route_4: NoneOrNanString[str] = Field(
        ..., description="Name of the Fourth Transit Route from the airport"
    )
    """
    Name of the Fourth Transit Route from the airport
    """

    from_airport_transit_route_4_other: NoneOrNanString[str] = Field(
        ..., description="Other Fourth Transit Route from the airport"
    )
    """
    Other Fourth Transit Route from the airport
    """

    egress_mode: NoneOrNanString[e.TravelMode] = Field(
        ..., description = "Egress mode from last transit vehicle for outbound trip"
    )
    """
    Egress mode from last transit vehicle for outbound trip.
    """

    egress_mode_other: NoneOrNanString[str] = Field(
        ..., description = "Other Egress mode from last transit vehicle for outbound trip"
    )
    """
    Other Egress mode from last transit vehicle for outbound trip.
    """

    egress_mode_grouped: NoneOrNanString[e.TravelModeGrouped] = Field(
        ..., description = "Grouped Egress mode from last transit vehicle for outbound trip"
    )
    """
    Grouped Egress mode from last transit vehicle for outbound trip.
    """

    transit_boarding_stop_name: NoneOrNanString[str] = Field(
        ..., description = "Name of the stop where respondent boarded the main transit mode"
    )
    """
    Name of the stop where respondent boarded the main transit mode
    """

    transit_boarding_latitude: NoneOrNanString[Latitude] = Field(
        ..., description = "Latitude of the stop where respondent boarded the main transit mode"
    )
    """
    Latitude of the stop where respondent boarded the main transit mode
    """

    transit_boarding_longitude: NoneOrNanString[Longitude] = Field(
        ..., description = "Longitude of the stop where respondent boarded the main transit mode"
    )
    """
    Longitude of the stop where respondent boarded the main transit mode
    """

    transit_alighting_stop_name: NoneOrNanString[str] = Field(
        ..., description = "Name of the stop where respondent got off the main transit mode"
    )
    """
    Name of the stop where respondent got off the main transit mode
    """

    transit_alighting_latitude: NoneOrNanString[Latitude] = Field(
        ..., description = "Latitude of the stop where respondent got off the main transit mode"
    )
    """
    Latitude of the stop where respondent got off the main transit mode
    """

    transit_alighting_longitude: NoneOrNanString[Longitude] = Field(
        ..., description = "Longitude of the stop where respondent got off the main transit mode"
    )
    """
    Longitude of the stop where respondent boarded the main transit mode
    """


    @model_validator(mode="after")
    def validate_record(cls, values):

        errors, severity_levels, num_errors = skip_logic_validator.validate("Trip", values.dict())
        # Update validation fields
        #values.valid_record = len(errors) == 0
        values.validation_error = errors
        values.validation_severity = cls.determine_severity(severity_levels)
        values.validation_num_errors = num_errors

        return values

    @staticmethod
    def determine_severity(severity_levels):
        if severity_levels["Critical"] > 0:
            return "Critical"
        elif severity_levels["Non-Critical"] > 0:
            return "Non-Critical"
        return "None"
    pass 

access_mode = Field(..., description='Access mode to first transit vehicle for inbound trip to the airport') class-attribute instance-attribute

Access mode to first transit vehicle for inbound trip to the airport.

access_mode_grouped = Field(..., description='Grouped Access mode to first transit vehicle for inbound trip to the airport') class-attribute instance-attribute

Grouped Access mode to first transit vehicle for inbound trip to the airport.

access_mode_other = Field(..., description='Other Access mode to first transit vehicle for inbound trip to the airport') class-attribute instance-attribute

Other Access mode to first transit vehicle for inbound trip to the airport.

destination_activity_type = Field(..., description='Activity type at the destination of the trip from the airport') class-attribute instance-attribute

Activity type at the destination of the trip from the airport.

destination_activity_type_other = Field(..., description='Activity type (other) at the destination of the trip from the airport') class-attribute instance-attribute

Activity type (other) at the destination of the trip from the airport.

destination_latitude = Field(..., description='Latitude coordinate of the destination address from the airport') class-attribute instance-attribute

Latitude coordinate of the destination address from the airport.

destination_longitude = Field(..., description='Longitude coordinate of the destination address from the airport') class-attribute instance-attribute

Longitude coordinate of the destination address from the airport.

destination_municipal_zone = Field(..., description='Municipal zone of the destination address for the trip to the airport') class-attribute instance-attribute

Municipal zone of the destination address for the trip to the airport

destination_name = Field(..., description='Place name of the destination from the airport') class-attribute instance-attribute

Place name of the destination from the airport.

destination_place_name = Field(..., description='Postal City of the destination address from the airport') class-attribute instance-attribute

Postal City of the destination address from the airport.

destination_pmsa = Field(..., description='Pseudo MSA of the destination address for the trip to the airport') class-attribute instance-attribute

Pseudo MSA of the origin destination for the trip to the airport

destination_state = Field(..., description='State of the destination address from the airport') class-attribute instance-attribute

State of the destination address from the airport.

destination_zip = Field(..., description='ZIP code of the destination address from the airport') class-attribute instance-attribute

ZIP code of the destination address from the airport.

egress_mode = Field(..., description='Egress mode from last transit vehicle for outbound trip') class-attribute instance-attribute

Egress mode from last transit vehicle for outbound trip.

egress_mode_grouped = Field(..., description='Grouped Egress mode from last transit vehicle for outbound trip') class-attribute instance-attribute

Grouped Egress mode from last transit vehicle for outbound trip.

egress_mode_other = Field(..., description='Other Egress mode from last transit vehicle for outbound trip') class-attribute instance-attribute

Other Egress mode from last transit vehicle for outbound trip.

from_airport_transit_route_1 = Field(..., description='Name of the First Transit Route from the airport') class-attribute instance-attribute

Name of the First Transit Route from the airport

from_airport_transit_route_1_other = Field(..., description='Other First Transit Route from the airport') class-attribute instance-attribute

Other First Transit Route from the airport

from_airport_transit_route_2 = Field(..., description='Name of the Second Transit Route from the airport') class-attribute instance-attribute

Name of the Second Transit Route from the airport

from_airport_transit_route_2_other = Field(..., description='Other Second Transit Route from the airport') class-attribute instance-attribute

Other Second Transit Route from the airport

from_airport_transit_route_3 = Field(..., description='Name of the Third Transit Route from the airport') class-attribute instance-attribute

Name of the Third Transit Route from the airport

from_airport_transit_route_3_other = Field(..., description='Other Third Transit Route from the airport') class-attribute instance-attribute

Other Third Transit Route from the airport

from_airport_transit_route_4 = Field(..., description='Name of the Fourth Transit Route from the airport') class-attribute instance-attribute

Name of the Fourth Transit Route from the airport

from_airport_transit_route_4_other = Field(..., description='Other Fourth Transit Route from the airport') class-attribute instance-attribute

Other Fourth Transit Route from the airport

inbound_or_outbound = Field(..., description='Whether the trip is inbound to the airport or outbound from the airport') class-attribute instance-attribute

Whether the trip is inbound to the airport or outbound from the airport.

main_mode = Field(..., description='Main Mode to/from airport') class-attribute instance-attribute

Main Mode to/from airport.

main_mode_grouped = Field(..., description='Grouped Main Mode to/from airport') class-attribute instance-attribute

Grouped Main Mode to/from airport

main_mode_other = Field(..., description='Name of the other Main Mode to/from airport') class-attribute instance-attribute

Name of the other Main Mode to/from airport.

main_transit_mode = Field(..., description='Main Transit mode to/from airport') class-attribute instance-attribute

Main Transit mode to/from airport.

non_airport_activity_type property

Activity type prior to traveling to the airport (for inbound) or activity traveling to do next (for outbound).

num_transit_transfers = Field(..., description='Number of transit transfers made by the respondent') class-attribute instance-attribute

Number of transit transfers made by the respondent.

number_transit_vehicles_from_airport = Field(..., description='Number of transit transfers for the inbound trip') class-attribute instance-attribute

Number of transit transfers for the inbound trip.

number_transit_vehicles_to_airport = Field(..., description='Number of transit transfers for the inbound trip to the airport') class-attribute instance-attribute

Number of transit transfers for the inbound trip to the airport

origin_activity_type = Field(..., description='Activity type at the origin of the trip to the airport') class-attribute instance-attribute

Activity type at the origin of the trip to the airport.

origin_activity_type_other = Field(..., description='Activity type at the origin of the trip to the airport') class-attribute instance-attribute

Activity type at the origin of the trip to the airport.

origin_latitude = Field(..., description='Latitude coordinate of the origin address for the trip to the airport') class-attribute instance-attribute

Latitude coordinate of the origin address for the trip to the airport.

origin_longitude = Field(..., description='Longitude coordinate of the origin address for the trip to the airport') class-attribute instance-attribute

Longitude coordinate of the origin address for the trip to the airport.

origin_municipal_zone = Field(..., description='Municipal zone of the origin address for the trip to the airport') class-attribute instance-attribute

Municipal zone of the origin address for the trip to the airport

origin_name = Field(..., description='Place name of the origin of the trip to the airport') class-attribute instance-attribute

Place name of the origin of the trip to the airport.

origin_place_name = Field(..., description='Postal City of the origin address for the trip to the airport') class-attribute instance-attribute

Postal City of the origin address for the trip to the airport.

origin_pmsa = Field(..., description='Pseudo MSA of the origin address for the trip to the airport') class-attribute instance-attribute

Pseudo MSA of the origin address for the trip to the airport

origin_state = Field(..., description='State of the origin address for the trip to the airport') class-attribute instance-attribute

State of the origin address for the trip to the airport.

origin_zip = Field(..., description='ZIP code of the origin address for the trip to the airport') class-attribute instance-attribute

ZIP code of the origin address for the trip to the airport.

parking_cost = Field(..., description='Amount respondent paid to park') class-attribute instance-attribute

Amount respondent paid to park.

parking_cost_frequency = Field(..., description='Frequency of reported parking cost (e.g., one-time, per hour, per day, per month)') class-attribute instance-attribute

Frequency of reported parking cost (e.g., one-time, per hour, per day, per month)

parking_cost_frequency_other = Field(..., description='Other frequency of reported parking cost') class-attribute instance-attribute

Other frequency of reported parking cost

parking_cost_numeric property

Numeric Value of parking cost

parking_location = Field(..., description="Name of respondent's parking location. ") class-attribute instance-attribute

Name of respondent’s parking location.

parking_location_other = Field(..., description="Name of respondent's (other) parking location. ") class-attribute instance-attribute

Name of respondent’s (other) parking location.

reimbursement = Field(..., description='Whether or not ground access cost will be reimbursed by employer or other non-household member') class-attribute instance-attribute

Whether or not ground access cost will be reimbursed by employer or other non-household member.

shared_van_other = Field(..., description='Name of the other shared van service used by respondent') class-attribute instance-attribute

Name of the other shared van service used by respondent.

taxi_fhv_fare = Field(..., description='Taxi or for-hire vehicle fare') class-attribute instance-attribute

Taxi or for-hire vehicle fare.

taxi_fhv_fare_numeric property

Numeric Value of Taxi Fare

taxi_fhv_wait = Field(..., description='Wait time for taxi or for-hire vehicle') class-attribute instance-attribute

Wait time for taxi or for-hire vehicle.

taxi_fhv_wait_numeric property

Numeric Value of Taxi Wait Time

to_airport_transit_route_1 = Field(..., description='Name of the First Transit Route to the airport') class-attribute instance-attribute

Name of the First Transit Route to the airport

to_airport_transit_route_1_other = Field(..., description='Other First Transit Route to the airport') class-attribute instance-attribute

Other First Transit Route to the airport

to_airport_transit_route_2 = Field(..., description='Name of the Second Transit Route to the airport') class-attribute instance-attribute

Name of the Second Transit Route to the airport

to_airport_transit_route_2_other = Field(..., description='Other Second Transit Route to the airport') class-attribute instance-attribute

Other Second Transit Route to the airport

to_airport_transit_route_3 = Field(..., description='Name of the Third Transit Route to the airport') class-attribute instance-attribute

Name of the Third Transit Route to the airport

to_airport_transit_route_3_other = Field(..., description='Other Third Transit Route to the airport') class-attribute instance-attribute

Other Third Transit Route to the airport

to_airport_transit_route_4 = Field(..., description='Name of the Fourth Transit Route to the airport') class-attribute instance-attribute

Name of the Fourth Transit Route to the airport

to_airport_transit_route_4_other = Field(..., description='Other Fourth Transit Route to the airport') class-attribute instance-attribute

Other Fourth Transit Route to the airport

transit_alighting_latitude = Field(..., description='Latitude of the stop where respondent got off the main transit mode') class-attribute instance-attribute

Latitude of the stop where respondent got off the main transit mode

transit_alighting_longitude = Field(..., description='Longitude of the stop where respondent got off the main transit mode') class-attribute instance-attribute

Longitude of the stop where respondent boarded the main transit mode

transit_alighting_stop_name = Field(..., description='Name of the stop where respondent got off the main transit mode') class-attribute instance-attribute

Name of the stop where respondent got off the main transit mode

transit_boarding_latitude = Field(..., description='Latitude of the stop where respondent boarded the main transit mode') class-attribute instance-attribute

Latitude of the stop where respondent boarded the main transit mode

transit_boarding_longitude = Field(..., description='Longitude of the stop where respondent boarded the main transit mode') class-attribute instance-attribute

Longitude of the stop where respondent boarded the main transit mode

transit_boarding_stop_name = Field(..., description='Name of the stop where respondent boarded the main transit mode') class-attribute instance-attribute

Name of the stop where respondent boarded the main transit mode

transit_routes_list = Field(..., description='List of transit routes used by the respondent (comma separated)') class-attribute instance-attribute

List of transit routes used by the respondent (comma separated)

Visitor

Bases: Respondent

Data Model for a visitor of the San Deigo Region. It includes attributes specific to a Visitor.

Source code in data_model/data_model.py
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
class Visitor(Respondent):
    """
    Data Model for a visitor of the San Deigo Region. It includes attributes specific to a Visitor.
    """

    convention_center: NoneOrNanString[e.YesNoType] = Field(
        ..., description = "Whether the visitor went/going to convention center"
    )
    """
    Whether the visitor went/going to convention center.
    """

    convention_center_activity: NoneOrNanString[e.ConventionCenterActivity] = Field(
        ..., description = "Type of activity that the respondent conducted at the convention center"
    )
    """
    Type of activity that the respondent conducted at the convention center.
    """

    convention_center_activity_other: NoneOrNanString[str] = Field(
        ..., description = "Type of activity (not listed) that the respondent conducted at the convention center"
    )
    """
    Type of activity (not listed) that the respondent conducted at the convention center.
    """

    nights_visited: NoneOrNan[e.TravelDuration] = Field(
        ..., description = "Number of nights the arriving air passengers will be in the San Diego Region"
    )
    """
    Number of nights the arriving air passengers will be in the San Diego Region.
    """

    general_use_transit_visitor_home: NoneOrNan[e.TransitUseFrequency] = Field(
        ..., description = "General transit use frequency by visitors of San Diego region when home"
    )
    """
    General transit use frequency by visitors of San Diego region when home.
    """

    pass

convention_center = Field(..., description='Whether the visitor went/going to convention center') class-attribute instance-attribute

Whether the visitor went/going to convention center.

convention_center_activity = Field(..., description='Type of activity that the respondent conducted at the convention center') class-attribute instance-attribute

Type of activity that the respondent conducted at the convention center.

convention_center_activity_other = Field(..., description='Type of activity (not listed) that the respondent conducted at the convention center') class-attribute instance-attribute

Type of activity (not listed) that the respondent conducted at the convention center.

general_use_transit_visitor_home = Field(..., description='General transit use frequency by visitors of San Diego region when home') class-attribute instance-attribute

General transit use frequency by visitors of San Diego region when home.

nights_visited = Field(..., description='Number of nights the arriving air passengers will be in the San Diego Region') class-attribute instance-attribute

Number of nights the arriving air passengers will be in the San Diego Region.

ENUMS

This section includes the various response options for survey variables

ActivityType

Bases: IntEnum

Integer mapping for activity types

Source code in data_model/enums.py
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
class ActivityType(IntEnum):
    """
    Integer mapping for activity types

    """
    USUAL_WORKPLACE = 1
    HOME = 2
    HOTEL = 3
    CONVENTION_CENTER = 4
    OTHER_BUSINESS = 5
    OTHER_RESIDENCE = 6 
    SAN_DIEGO_AIRPORT = 7
    OTHER = 98
    REFUSED = 99

Age

Bases: IntEnum

Integer mapping for age categories

Source code in data_model/enums.py
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
class Age(IntEnum):
    """
    Integer mapping for age categories
    """

    AGE_18_19 = 1
    AGE_20_24 = 2
    AGE_25_29 = 3
    AGE_30_34 = 4
    AGE_35_39 = 5
    AGE_40_44 = 6
    AGE_45_49 = 7
    AGE_50_54 = 8
    AGE_55_59 = 9
    AGE_60_64 = 10
    AGE_65_74 = 11
    AGE_75_OR_MORE = 12
    PREFER_NOT_TO_SAY = 13
    OTHER = 98
    REFUSED = 99

Airline

Bases: IntEnum

Integer Mapping for airlines at SAN

Source code in data_model/enums.py
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
class Airline(IntEnum):
    """
    Integer Mapping for airlines at SAN
    """
    AIR_CANADA = 1
    ALASKA_AIRLINES = 2
    ALLEGIANT_AIR = 3
    AMERICAN_AIRLINES = 4
    BREEZE = 5
    BRITISH_AIRWAYS = 6
    DELTA_AIRLINES = 7
    HAWAIIAN_AIRLINES = 8
    JAPAN_AIRLINES = 9
    JETBLUE = 10
    LUFTHANSHA = 11
    UNITED_AIRLINES = 12
    WESTJET = 13
    FRONTIER_AIRLINES = 14
    SOUTHWEST_AIRLINES = 15
    SPIRIT = 16
    SUNCOUNTY_AIRLINES = 17
    OTHER_SPECIFY = 98

BusRoutes

Bases: Enum

Enum Mappings for MTS Bus Routes

Source code in data_model/enums.py
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
class BusRoutes(Enum):
    """
    Enum Mappings for MTS Bus Routes
    """
    MTS_4_12TH_IMPERIAL_TROLLEY_LOMITA_VILLAGE = "MTS_1_4"
    MTS_AIR_OLD_TOWN_TO_AIRPORT_SHUTTLE = "MTS_1_AIR"
    MTS_7_DOWNTOWN_SAN_DIEGO_UNIVERSITY_COLLEGE = "MTS_1_7"
    MTS_41_FASHION_VALLEY_UCSD = "MTS_1_41"
    MTS_964_MIRA_MESA_ALLIANT_UNIVERSITY_VIA_MCTS = "MTS_1_964"
    MTS_8_OLD_TOWN_BALBOA_AV_TC = "MTS_1_8"
    MTS_992_AIRPORT_DOWNTOWN_SHUTTLE = "MTS_1_992"
    MTS_1_FASHION_VALLEY_LA_MESA = "MTS_1_1"
    MTS_709_H_ST_TRANSIT_CENTER_OTAY_RANCH_TOWN_CENTER = "MTS_1_709"
    MTS_901_IRIS_TRANSIT_CENTER_DOWNTOWN_SAN_DIEGO = "MTS_1_901"
    MTS_BLUE_SAN_YSIDRO_UTC = "MTS_1_Blue"
    MTS_5_DOWNTOWN_SAN_DIEGO_EUCLID_TRANSIT_CENTER = "MTS_1_5"
    MTS_235_DOWNTOWN_ESCONDIDO_TRANSIT_CENTER = "MTS_1_235"
    MTS_933_IRIS_TC_LOOP_IMPERIAL_BEACH_COUNTERCLOCK = "MTS_1_933"
    MTS_88_OLD_TOWN_FASHION_VALLEY = "MTS_1_88"
    OTHER = 98

CarAvailability

Bases: IntEnum

Integer mapping for car availability

Source code in data_model/enums.py
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
class CarAvailability(IntEnum):
    """
    Integer mapping for car availability
    """

    CAR_AVAILABLE = 1
    DONT_HAVE_CAR = 2
    CAR_UNAVAILABLE = 3
    DONT_DRIVE = 4
    OTHER = 98
    REFUSED = 99

CarryOns

Bases: IntEnum

Integer mapping for number of carryon bags

Source code in data_model/enums.py
556
557
558
559
560
561
562
563
564
565
566
567
568
class CarryOns(IntEnum):
    """
    Integer mapping for number of carryon bags
    """
    NONE = 0
    ONE = 1
    TWO = 2
    THREE = 3
    FOUR = 4
    FIVE = 5
    SIX = 6
    SEVEN = 7
    EIGHT_OR_MORE = 8

CheckedBags

Bases: IntEnum

Integer mapping for number of checked bags

Source code in data_model/enums.py
541
542
543
544
545
546
547
548
549
550
551
552
553
class CheckedBags(IntEnum):
    """
    Integer mapping for number of checked bags
    """
    NONE = 0
    ONE = 1
    TWO = 2
    THREE = 3
    FOUR = 4
    FIVE = 5
    SIX = 6
    SEVEN = 7
    EIGHT_OR_MORE = 8

CommuteDays

Bases: IntEnum

Integer mapping for number of days employee commutes to SAN

Source code in data_model/enums.py
774
775
776
777
778
779
780
781
782
783
784
785
786
787
class CommuteDays(IntEnum):
    """
    Integer mapping for number of days employee commutes to SAN
    """
    ZERO = 0
    ONE = 1
    TWO = 2
    THREE = 3
    FOUR = 4
    FIVE = 5
    SIX = 6
    SEVEN = 7
    OTHER = 98
    REFUSED = 99

ConventionCenterActivity

Bases: IntEnum

Integer mapping for convention center activities

Source code in data_model/enums.py
529
530
531
532
533
534
535
536
537
538
class ConventionCenterActivity(IntEnum):
    """
    Integer mapping for convention center activities
    """
    ATTENDEE = 1
    EXHIBITOR = 2
    MEETING_PLANNER = 3
    CONTRACTOR = 4
    OTHER_SPECIFY = 98
    NOT_APPLICABLE = 99

Country

Bases: IntEnum

Integer Mapping for all the countries in the world

Source code in data_model/enums.py
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
class Country(IntEnum):
    """
    Integer Mapping for all the countries in the world
    """
    UNITED_STATES = 1
    MEXICO = 2
    AFGHANISTAN = 3
    ALBANIA = 4
    ALGERIA = 5
    ANDORRA = 6
    ANGOLA = 7
    ANTIGUA_AND_BARBUDA = 8
    ARGENTINA = 9
    ARMENIA = 10
    AUSTRALIA = 11
    AUSTRIA = 12
    AZERBAIJAN = 13
    BAHAMAS = 14
    BAHRAIN = 15
    BANGLADESH = 16
    BARBADOS = 17
    BELARUS = 18
    BELGIUM = 19
    BELIZE = 20
    BENIN = 21
    BHUTAN = 22
    BOLIVIA = 23
    BOSNIA_AND_HERZEGOVINA = 24
    BOTSWANA = 25
    BRAZIL = 26
    BRUNEI = 27
    BULGARIA = 28
    BURKINA_FASO = 29
    BURUNDI = 30
    COTE_DIVOIRE = 31
    CABO_VERDE = 32
    CAMBODIA = 33
    CAMEROON = 34
    CANADA = 35
    CENTRAL_AFRICAN_REPUBLIC = 36
    CHAD = 37
    CHILE = 38
    CHINA = 39
    COLOMBIA = 40
    COMOROS = 41
    CONGO_CONGO_BRAZZAVILLE = 42
    COSTA_RICA = 43
    CROATIA = 44
    CUBA = 45
    CYPRUS = 46
    CZECHIA_CZECH_REPUBLIC = 47
    DEMOCRATIC_REPUBLIC_OF_THE_CONGO = 48
    DENMARK = 49
    DJIBOUTI = 50
    DOMINICA = 51
    DOMINICAN_REPUBLIC = 52
    ECUADOR = 53
    EGYPT = 54
    EL_SALVADOR = 55
    EQUATORIAL_GUINEA = 56
    ERITREA = 57
    ESTONIA = 58
    ESWATINI_FMR_SWAZILAND = 59
    ETHIOPIA = 60
    FIJI = 61
    FINLAND = 62
    FRANCE = 63
    GABON = 64
    GAMBIA = 65
    GEORGIA = 66
    GERMANY = 67
    GHANA = 68
    GREECE = 69
    GRENADA = 70
    GUATEMALA = 71
    GUINEA = 72
    GUINEA_BISSAU = 73
    GUYANA = 74
    HAITI = 75
    HOLY_SEE = 76
    HONDURAS = 77
    HUNGARY = 78
    ICELAND = 79
    INDIA = 80
    INDONESIA = 81
    IRAN = 82
    IRAQ = 83
    IRELAND = 84
    ISRAEL = 85
    ITALY = 86
    JAMAICA = 87
    JAPAN = 88
    JORDAN = 89
    KAZAKHSTAN = 90
    KENYA = 91
    KIRIBATI = 92
    KUWAIT = 93
    KYRGYZSTAN = 94
    LAOS = 95
    LATVIA = 96
    LEBANON = 97
    LESOTHO = 98
    LIBERIA = 99
    LIBYA = 100
    LIECHTENSTEIN = 101
    LITHUANIA = 102
    LUXEMBOURG = 103
    MADAGASCAR = 104
    MALAWI = 105
    MALAYSIA = 106
    MALDIVES = 107
    MALI = 108
    MALTA = 109
    MARSHALL_ISLANDS = 110
    MAURITANIA = 111
    MAURITIUS = 112
    MICRONESIA = 113
    MOLDOVA = 114
    MONACO = 115
    MONGOLIA = 116
    MONTENEGRO = 117
    MOROCCO = 118
    MOZAMBIQUE = 119
    MYANMAR_FORMERLY_BURMA = 120
    NAMIBIA = 121
    NAURU = 122
    NEPAL = 123
    NETHERLANDS = 124
    NEW_ZEALAND = 125
    NICARAGUA = 126
    NIGER = 127
    NIGERIA = 128
    NORTH_KOREA = 129
    NORTH_MACEDONIA = 130
    NORWAY = 131
    OMAN = 132
    PAKISTAN = 133
    PALAU = 134
    PALESTINE_STATE = 135
    PANAMA = 136
    PAPUA_NEW_GUINEA = 137
    PARAGUAY = 138
    PERU = 139
    PHILIPPINES = 140
    POLAND = 141
    PORTUGAL = 142
    QATAR = 143
    ROMANIA = 144
    RUSSIA = 145
    RWANDA = 146
    SAINT_KITTS_AND_NEVIS = 147
    SAINT_LUCIA = 148
    SAINT_VINCENT_AND_THE_GRENADINES = 149
    SAMOA = 150
    SAN_MARINO = 151
    SAO_TOME_AND_PRINCIPE = 152
    SAUDI_ARABIA = 153
    SENEGAL = 154
    SERBIA = 155
    SEYCHELLES = 156
    SIERRA_LEONE = 157
    SINGAPORE = 158
    SLOVAKIA = 159
    SLOVENIA = 160
    SOLOMON_ISLANDS = 161
    SOMALIA = 162
    SOUTH_AFRICA = 163
    SOUTH_KOREA = 164
    SOUTH_SUDAN = 165
    SPAIN = 166
    SRI_LANKA = 167
    SUDAN = 168
    SURINAME = 169
    SWEDEN = 170
    SWITZERLAND = 171
    SYRIA = 172
    TAJIKISTAN = 173
    TANZANIA = 174
    THAILAND = 175
    TIMOR_LESTE = 176
    TOGO = 177
    TONGA = 178
    TRINIDAD_AND_TOBAGO = 179
    TUNISIA = 180
    TURKEY = 181
    TURKMENISTAN = 182
    TUVALU = 183
    UGANDA = 184
    UKRAINE = 185
    UNITED_ARAB_EMIRATES = 186
    UNITED_KINGDOM = 187
    URUGUAY = 188
    UZBEKISTAN = 189
    VANUATU = 190
    VENEZUELA = 191
    VIETNAM = 192
    YEMEN = 193
    ZAMBIA = 194
    ZIMBABWE = 195

DepartTime

Bases: IntEnum

Integer mapping for time categories

Source code in data_model/enums.py
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
class DepartTime(IntEnum):  
    """
    Integer mapping for time categories
    """

    FIVE_TO_FIVE_THIRTY = 1
    FIVE_THIRTY_TO_SIX = 2
    SIX_TO_SIX_THIRTY = 3
    SIX_THIRTY_TO_SEVEN = 4
    SEVEN_TO_SEVEN_THIRTY = 5
    SEVEN_THIRTY_TO_EIGHT = 6
    EIGHT_TO_EIGHT_THIRTY = 7
    EIGHT_THIRTY_TO_NINE = 8
    NINE_TO_NINE_THIRTY = 9
    NINE_THIRTY_TO_TEN = 10
    TEN_TO_TEN_THIRTY = 11
    TEN_THIRTY_TO_ELEVEN = 12
    ELEVEN_TO_ELEVEN_THIRTY = 13
    ELEVEN_THIRTY_TO_NOON = 14
    NOON_TO_TWELVE_THIRTY = 15
    TWELVE_THIRTY_TO_THIRTEEN = 16
    THIRTEEN_TO_THIRTEEN_THIRTY = 17
    THIRTEEN_THIRTY_TO_FOURTEEN = 18
    FOURTEEN_TO_FOURTEEN_THIRTY = 19
    FOURTEEN_THIRTY_TO_FIFTEEN = 20
    FIFTEEN_TO_FIFTEEN_THIRTY = 21
    FIFTEEN_THIRTY_TO_SIXTEEN = 22
    SIXTEEN_TO_SIXTEEN_THIRTY = 23
    SIXTEEN_THIRTY_TO_SEVENTEEN = 24
    SEVENTEEN_TO_SEVENTEEN_THIRTY = 25
    SEVENTEEN_THIRTY_TO_EIGHTEEN = 26
    EIGHTEEN_TO_EIGHTEEN_THIRTY = 27
    EIGHTEEN_THIRTY_TO_NINETEEN = 28
    NINETEEN_TO_NINETEEN_THIRTY = 29
    NINETEEN_THIRTY_TO_TWENTY = 30
    TWENTY_TO_TWENTY_THIRTY = 31
    TWENTY_THIRTY_TO_TWENTY_ONE = 32
    TWENTY_ONE_TO_TWENTY_ONE_THIRTY = 33
    TWENTY_ONE_THIRTY_TO_TWENTY_TWO = 34
    TWENTY_TWO_TO_TWENTY_TWO_THIRTY = 35
    TWENTY_TWO_THIRTY_TO_TWENTY_THREE = 36
    TWENTY_THREE_TO_TWENTY_THREE_THIRTY = 37
    TWENTY_THREE_THIRTY_TO_MIDNIGHT = 38
    MIDNIGHT_TO_ZERO_THIRTY = 39
    ZERO_THIRTY_TO_ONE = 40
    ONE_TO_ONE_THIRTY = 41
    ONE_THIRTY_TO_TWO = 42
    TWO_TO_TWO_THIRTY = 43
    TWO_THIRTY_TO_THREE = 44
    THREE_TO_THREE_THIRTY = 45
    THREE_THIRTY_TO_FOUR = 46
    FOUR_TO_FOUR_THIRTY = 47
    FOUR_THIRTY_TO_FIVE = 48

Employers

Bases: IntEnum

Integer mapping for employers

Source code in data_model/enums.py
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
class Employers(IntEnum):
    """
    Integer mapping for employers

    """
    AIR_CANADA = 1	
    ALASKA_AIRLINES = 2	
    ALLEGIANT_AIR = 3	
    AMERICAN_AIRLINES = 4	
    ARTISAN_MARKET = 5	
    ASIAN_KITCHEN = 6	
    ASPIRE_LOUNGE = 7	
    BANKERS_HILL_BAR_AND_MARKET = 8	
    BAY_BOOKS_OF_CORONADO = 9	
    BE_RELAX_SPA = 10	
    BEAUDEVIN_VINE_AND_TAPAS_BAR = 11	
    BRITISH_AIRWAYS = 12	
    BROOKSTONE = 13	
    BUBBLES_SEAFOOD_AND_WINE_BAR = 14	
    CALIFORNIA_PIZZA_KITCHEN = 15	
    CAMDEN_FOOD_CO = 16	
    CIAO_GOURMET_MARKET = 17	
    CNBC_EXPRESS = 18	
    CNBC_NEWS_SAN_DIEGO = 19	
    DARK_HORSE_COFFEE_ROASTERS = 20	
    DELTA_AIRLINES = 21	
    DELTA_SKY_CLUB = 22	
    DISCOVER_SAN_DIEGO = 23	
    EINSTEIN_BROS_BAGELS = 24	
    ELEGANT_DESSERTS = 25	
    FRONTIER_AIRLINES = 26	
    GASLAMP_MARKETPLACE = 27	
    HAWAIIAN_AIRLINES = 28	
    HUDSON_NEWS = 29	
    INMOTION_ENTERTAINMENT = 30	
    JACK_IN_THE_BOX = 31	
    JAPAN_AIRLINES = 32	
    JETBLUE = 33	
    JETBOX = 34	
    JETBOX_MARKET = 35	
    KUSI_NEWS = 36	
    LINDBERGH_FIELD_NEWS = 37	
    LUFTHANSA = 38	
    OLD_TOWN_NEWS_AND_MARKET = 39	
    PACIFICA_BREEZE_CAFE = 40	
    PANDA_EXPRESS = 41	
    PANNIKIN_COFFEE_AND_TEA = 42	
    PEETS_COFFEE_AND_TEA = 43	
    PGA_TOUR_GRILL = 44	
    PGA_TOUR_SHOP = 45	
    PHILS_BBQ = 46	
    PRADO_AT_THE_AIRPORT = 47	
    QDOBA_MEXICAN_GRILL = 48	
    RED_MANGO = 49	
    RIP_CURL = 50	
    SAN_LIFE_MARKET = 51	
    SAND_NEWS = 52	
    SKY_FREE_SHOP = 53	
    SOUNDBALANCE = 54	
    SOUTHWEST_AIRLINES = 55	
    SPIRIT = 56	
    STARBUCKS = 57	
    STELLAR_NEWS_EXPRESS = 58	
    STONE_BREWING_COMPANY = 59	
    SUNCOUNTY_AIRLINES = 60	
    SUNGLASS_HUT = 61	
    SWAROVSKI = 62	
    TECH_ON_THE_GO = 63	
    THE_BEACH_HOUSE = 64	
    THE_COUNTER_CUSTOM_BUILT_BURGERS = 65	
    TOMMY_VS_PIZZERIA = 66	
    TRANSPORTATION_SECURITY_ADMINISTRATION_TSA = 67	
    UNITED_AIRLINES = 68	
    UNITED_CLUB = 69	
    UNITED_SERVICE_ORGANIZATIONS = 70	
    URBAN_CRAVE = 71	
    US_CUSTOMS_AND_BORDER_PROTECTION = 72	
    US_NEWS_AND_WORLD_REPORT = 73	
    WARWICKS_OF_LA_JOLLA = 74	
    WESTJET = 75
    SDCRAA_SDIA = 76
    FLAGSHIP = 77	
    HMS_HOST = 78
    OTHER_SPECIFY = 98	

FlightPurpose

Bases: IntEnum

Integer Mapping for Flight Purposes

Source code in data_model/enums.py
516
517
518
519
520
521
522
523
524
525
526
class FlightPurpose(IntEnum):
    """
    Integer Mapping for Flight Purposes
    """
    BUSINESS_WORK = 1
    LEISURE_FAMILY = 2
    COMBINATION_BUSINESS_LEISURE = 3
    PERSONAL = 4
    SCHOOL = 5
    COMMUTE = 6
    OTHER_SPECIFY = 98

Gender

Bases: IntEnum

Integer mapping for gender

Source code in data_model/enums.py
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
class Gender(IntEnum):
    """
    Integer mapping for gender
    """
    MALE = 1
    FEMALE = 2
    TRANSGENDER = 3
    NON_BINARY_THIRD_GENDER = 4
    PREFER_NOT_TO_SAY = 5
    OTHER_SPECIFY = 98
    REFUSED = 99

HoursWorked

Bases: IntEnum

Integer mapping for number of hours employee works at SAN

Source code in data_model/enums.py
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
class HoursWorked(IntEnum):
    """
    Integer mapping for number of hours employee works at SAN
    """

    ZERO = 1
    ONE_TO_TEN = 2
    ELEVEN_TO_TWENTY = 3
    TWENTY_ONE_TO_THIRTY = 4
    THIRTY_ONE_TO_FORTY = 5
    FORTY_ONE_TO_FIFTY = 6
    FIFTY_ONE_TO_SIXTY = 7
    SIXTY_ONE_TO_SEVENTY = 8
    SEVENTY_ONE_TO_EIGHTY = 9
    MORE_THAN_EIGHTY = 10
    OTHER = 98
    REFUSED = 99

HouseholdIncome

Bases: IntEnum

Integer mapping for household income ranges

Source code in data_model/enums.py
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
class HouseholdIncome(IntEnum):
    """
    Integer mapping for household income ranges
    """

    LESS_THAN_15K = 1
    BETWEEN_15K_20K = 2
    BETWEEN_20K_25K = 3
    BETWEEN_25K_30K = 4
    BETWEEN_30K_35K = 5
    BETWEEN_35K_40K = 6
    BETWEEN_40K_45K = 7
    BETWEEN_45K_50K = 8
    BETWEEN_50K_60K = 9
    BETWEEN_60K_75K = 10
    BETWEEN_75K_100K = 11
    BETWEEN_100K_150K = 12
    BETWEEN_150_199K = 13
    PREFER_NOT_TO_SAY = 14  
    BETWEEN_200_299K = 15
    MORE_THAN_300K = 16
    MORE_THAN_150K = 17
    OTHER = 98
    REFUSED = 99

HouseholdSize

Bases: IntEnum

Integer mapping for number of persons in household

Source code in data_model/enums.py
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
class HouseholdSize(IntEnum):
    """
    Integer mapping for number of persons in household
    """

    ONE = 1
    TWO = 2
    THREE = 3
    FOUR = 4
    FIVE = 5
    SIX = 6
    SEVEN = 7
    EIGHT = 8
    NINE = 9
    TEN_OR_MORE = 10
    OTHER = 98
    REFUSED = 99

HouseholdVehicles

Bases: IntEnum

Integer mapping for number of vehicles in household

Source code in data_model/enums.py
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
class HouseholdVehicles(IntEnum):
    """
    Integer mapping for number of vehicles in household
    """

    NONE = 0
    ONE = 1
    TWO = 2
    THREE = 3
    FOUR = 4
    FIVE = 5
    SIX = 6
    SEVEN = 7
    EIGHT_OR_MORE = 8
    OTHER = 98
    REFUSED = 99

HouseholdWorkers

Bases: IntEnum

Integer mapping for number of workers in household

Source code in data_model/enums.py
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
class HouseholdWorkers(IntEnum):
    """
    Integer mapping for number of workers in household
    """

    NONE = 0
    ONE = 1
    TWO = 2
    THREE = 3
    FOUR = 4
    FIVE = 5
    SIX = 6
    SEVEN = 7
    EIGHT = 8
    NINE = 9
    TEN_OR_MORE = 10
    OTHER = 98
    REFUSED = 99

InboundOutbound

Bases: IntEnum

Integer mapping for inbound and outbound flights

Source code in data_model/enums.py
19
20
21
22
23
24
25
class InboundOutbound(IntEnum):
    """
    Integer mapping for inbound and outbound flights
    """

    INBOUND_TO_AIRPORT = 1
    OUTBOUND_FROM_AIRPORT = 2

InterviewLocation

Bases: IntEnum

Integer Mapping for interview locations

Source code in data_model/enums.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
class InterviewLocation(IntEnum):
    """
    Integer Mapping for interview locations
    """
    TERMINAL_1 = 1
    TERMINAL_2 = 2
    ONBOARD_992 = 3
    ONBOARD_FLYER = 4
    RENTAL_CENTER = 5
    PASSENGER_PARKING = 6
    EMPLOYEE_PARKING = 7
    OTHER_SPECIFY = 98

ModeDecision

Bases: IntEnum

Integer mapping for decisions to choose a commute mode

Source code in data_model/enums.py
971
972
973
974
975
976
977
978
979
980
981
982
983
984
class ModeDecision(IntEnum):
    """
    Integer mapping for decisions to choose a commute mode
    """
    LOWEST_COST = 1
    SHORTEST_DOOR_TO_DOOR_TRAVEL_TIME = 2
    SMALLEST_CHANCE_FOR_DELAYS = 3
    MOST_COMFORTABLE = 4
    LEAST_WALKING = 5
    DEPENDS_ON_TIME_OF_DAY = 6
    DEPENDS_ON_TRAVEL_PARTY = 7
    DEPENDS_ON_WHO_PAYS = 8
    OTHER_SPECIFY = 98
    REFUSED = 99

NumTransfers

Bases: IntEnum

Integer mapping for number of transfers

Source code in data_model/enums.py
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
class NumTransfers(IntEnum): 
    """
    Integer mapping for number of transfers
    """
    NONE = 0
    ONE = 1
    TWO = 2
    THREE = 3
    FOUR_OR_MORE = 4 
    OTHER = 98
    REFUSED = 99

OccupationDetail

Bases: IntEnum

Integer mapping for the occupation details for an airport employee

Source code in data_model/enums.py
744
745
746
747
748
749
750
751
752
class OccupationDetail(IntEnum):
    """
    Integer mapping for the occupation details for an airport employee
    """
    WORK_NEAR_PASSENGERS = 1
    WORK_IN_OFFICE = 2
    WORK_ELSEWHERE = 3
    OTHER = 98
    REFUSED = 99

Occupations

Bases: IntEnum

Integer mapping for occupations

Source code in data_model/enums.py
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
class Occupations(IntEnum):
    """
    Integer mapping for occupations

    """

    AIRCRAFT_MECHANIC = 1
    PILOT = 2
    AIRCRAFT_SVC_ATTENDANT = 3
    AIR_TRAFFIC_CONTROLLER = 4
    FLIGHT_ATTENDANT = 5
    TICKET_AGENT = 6
    CARGO_AGENT = 7
    CARGO_HANDLER = 8
    BLDG_MAINTENANCE_CLEANING = 9
    PARKING_ATTENDANT = 10
    DRIVER = 11
    TSA = 12
    LAW_ENFORCEMENT = 13
    GENERAL_AND_OPERATIONS_MANAGERS = 14
    PROGRAM_AND_PROJECT_MANAGERS = 15
    RETAIL_RESTAURANT = 16
    CONSTRUCTION = 17
    OTHER_LABORERS = 18
    OTHER_CUSTOMER_SUPPORT = 19
    OTHER_ADMIN_SUPPORT = 20
    OTHER_SPECIFY = 98
    REFUSED = 99

OtherFlightAndTransitUseFrequency

Bases: IntEnum

Integer Mapping for other aiport’s flight and transit use frequency

Source code in data_model/enums.py
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
class OtherFlightAndTransitUseFrequency(IntEnum):
    """
    Integer Mapping for other aiport's flight and transit use frequency
    """
    NONE = 0
    ONE_TIME = 1
    TWO_TIMES = 2
    THREE_TIMES = 3
    FOUR_TIMES = 4
    MORE_THAN_FIVE_TIMES = 5
    NEVER = 6
    OTHER = 98
    REFUSED = 99

PMSA

Bases: IntEnum

Integer Mapping for Pseudo Metropolitan Statistical Areas

Source code in data_model/enums.py
100
101
102
103
104
105
106
107
108
109
110
111
112
class PMSA(IntEnum):
    """
    Integer Mapping for Pseudo Metropolitan Statistical Areas
    """
    DOWNTOWN = 1
    CENTRAL = 2
    NORTH_CITY = 3
    SOUTH_SUBURBAN = 4
    EAST_SUBURBAN = 5
    NORTH_COUNTY_WEST = 6
    NORTH_COUNTY_EAST = 7
    EAST_COUNTY = 8
    EXTERNAL = 99

ParkingCostFrequency

Bases: IntEnum

Integer mapping for parking cost frequencies

Source code in data_model/enums.py
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
class ParkingCostFrequency(IntEnum):
    """
    Integer mapping for parking cost frequencies
    """
    TOTAL = 1
    MONTHLY = 2
    DAILY = 3
    HOURLY = 4
    OTHER_SPECIFY = 98
    REFUSED = 99

ParkingLocation

Bases: IntEnum

Integer Mapping for Airport parking locations

Source code in data_model/enums.py
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
class ParkingLocation(IntEnum):
    """
    Integer Mapping for Airport parking locations
    """
    TERM1_PARKING_PLAZA = 1
    TERM2_PARKING_PLAZA = 2
    TERM1_CURBSIDE_VALET = 3
    TERM2_CURBSIDE_VALET = 4
    OFF_AIRPORT_PARKING = 5
    EMPLOYEE_LOT_3665_ADMIRAL_BOLAND_WAY = 6
    ADMIN_BUILDING_LOT_2417_MCCAIN_ROAD = 7
    OTHER = 98
    REFUSED = 99

ParkingReimbursement

Bases: IntEnum

Integer mapping for Parking Reimbursement Status

Source code in data_model/enums.py
1028
1029
1030
1031
1032
1033
1034
1035
class ParkingReimbursement(IntEnum):
    """
    Integer mapping for Parking Reimbursement Status
    """
    REIMBURSED_EMPLOYER_CLIENT = 1
    REIMBURSED_OTHER_THIRD_PARTY = 2
    NOT_REIMBURSED = 3
    DONT_KNOW = 4

PartySize

Bases: IntEnum

Integer mapping for number of persons in travel party (apart from respondent)

Source code in data_model/enums.py
588
589
590
591
592
593
594
595
596
597
598
599
600
601
class PartySize(IntEnum):
    """
    Integer mapping for number of persons in travel party (apart from respondent)
    """
    NONE = 0
    ONE = 1  
    TWO = 2
    THREE = 3
    FOUR = 4    
    FIVE = 5
    SIX = 6
    SEVEN_OR_MORE = 7
    OTHER = 98
    REFUSED = 99

PassengerSegment

Bases: IntEnum

Integer Mapping for type of passenger segment

Source code in data_model/enums.py
50
51
52
53
54
55
56
57
class PassengerSegment(IntEnum):
    """
    Integer Mapping for type of passenger segment
    """
    RESIDENT_ARRIVING = 1
    RESIDENT_DEPARTING = 2
    VISITOR_ARRIVING = 3
    VISITOR_DEPARTING = 4

PassengerType

Bases: IntEnum

Integer Mapping for type of passenger

Source code in data_model/enums.py
40
41
42
43
44
45
46
47
class PassengerType(IntEnum):
    """
    Integer Mapping for type of passenger
    """

    ARRIVING = 1
    DEPARTING = 2
    CONNECTING = 3

ReasonsNoTransit

Bases: IntEnum

Integer mapping for reasons of not choosing transit

Source code in data_model/enums.py
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
class ReasonsNoTransit(IntEnum):
    """
    Integer mapping for reasons of not choosing transit
    """
    NOT_CONVENIENT = 1
    DISLIKE_CROWDED_TRAINS_BUSES = 2
    NOT_FLEXIBLE = 3
    NOT_RELIABLE = 4
    NOT_SAFE = 5
    TAKES_TOO_LONG = 6
    NOT_ECONOMICAL = 7
    DONT_KNOW_HOW = 8
    TOO_MUCH_WALKING_STAIRS = 9
    NO_GOOD_OPTIONS = 10
    DISLIKE_PUBLIC_TRANSPORT = 11
    DISLIKE_PUBLIC_TRANSPORT_WITH_LUGGAGE = 12
    OTHER_SPECIFY = 98

ResidentVisitor

Bases: IntEnum

Integer Mapping for Residence Zones

Source code in data_model/enums.py
114
115
116
117
118
119
120
121
122
123
124
125
126
127
class ResidentVisitor(IntEnum):
    """
    Integer Mapping for Residence Zones
    """
    SAN_DIEGO_REGION = 1
    OTHER_SOUTHERN_CALIFORNIA = 2
    OTHER_CALIFORNIA = 3
    TIJUANA_REGION = 4
    OTHER_BAJA_CALIFORNIA = 5
    OTHER_STATE_US = 6
    OTHER_STATE_MEXICO = 7
    NONE_OF_THE_ABOVE = 8
    OTHER = 98
    REFUSED = 99

ResidentVisitorFollowup

Bases: IntEnum

Integer Mapping for the followup question to respondent if they are neither a visitor nor a resident - if they are visiting SAN Diego

Source code in data_model/enums.py
84
85
86
87
88
89
class ResidentVisitorFollowup(IntEnum):
    """
    Integer Mapping for the followup question to respondent if they are neither a visitor nor a resident - if they are visiting SAN Diego
    """
    VISITING_THE_REGION = 1
    LIVE_OUTSIDE_REGION_TRAVELED_TO_AIRPORT = 2

ResidentVisitorGeneral

Bases: IntEnum

Integer Mapping for the respondent if they are resident, visitor or neither. First option if departing, second if arriving

Source code in data_model/enums.py
71
72
73
74
75
76
77
78
79
80
81
class ResidentVisitorGeneral(IntEnum):
    """
    Integer Mapping for the respondent if they are resident, visitor or neither. First option if departing, second if arriving
    """
    GOING_HOME = 1
    LEAVING_HOME = 2
    VISITING = 3
    COMING_HOME = 4
    NEITHER = 5
    OTHER = 98
    REFUSED = 99

ResidentVisitorPurpose

Bases: IntEnum

Integer Mapping for resident/visitor and flight purpose segmentation

Source code in data_model/enums.py
60
61
62
63
64
65
66
67
68
class ResidentVisitorPurpose(IntEnum):
    """
    Integer Mapping for resident/visitor and flight purpose segmentation
    """
    RESIDENT_BUSINESS = 1
    RESIDENT_NON_BUSINESS = 2
    VISITOR_BUSINESS = 3
    VISITOR_NON_BUSINESS = 4
    EMPLOYEE = 5

SPDropoffType

Bases: IntEnum

Represents the type of person who dropped off the respondent at the airport

Source code in data_model/enums.py
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
class SPDropoffType(IntEnum):
    """
    Represents the type of person who dropped off the respondent at the airport
    """
    SPOUSE_PARTNER = 1
    PARENT = 2
    CHILD = 3
    OTHER_RELATIVE = 4
    FRIEND = 5
    COLLEAGUE = 6
    OTHER = 7

SPImportance

Bases: IntEnum

Importance levels for Stated Preference Responses

Source code in data_model/enums.py
1262
1263
1264
1265
1266
1267
1268
1269
1270
class SPImportance(IntEnum):
    """
    Importance levels for Stated Preference Responses
    """
    NOT_IMPORTANT = 1
    SLIGHTLY_IMPORTANT = 2
    IMPORTANT = 3
    VERY_IMPORTANT = 4
    EXTREMELY_IMPORTANT = 5

SPLikelihood

Bases: IntEnum

Likelihood levels for Stated Preference Responses

Source code in data_model/enums.py
1292
1293
1294
1295
1296
1297
1298
1299
1300
class SPLikelihood(IntEnum):
    """
    Likelihood levels for Stated Preference Responses
    """
    HIGHLY_UNLIKELY = 1
    UNLIKELY = 2
    NEUTRAL_DONT_KNOW = 3
    LIKELY = 4
    VERY_LIKELY = 5

SPNumTransfers

Bases: IntEnum

Number of transfers levels for Stated Preference Responses

Source code in data_model/enums.py
1282
1283
1284
1285
1286
1287
1288
1289
1290
class SPNumTransfers(IntEnum):
    """
    Number of transfers levels for Stated Preference Responses
    """
    NONE = 0
    ONE = 1
    TWO = 2
    THREE_OR_MORE = 3
    NOT_WILLING_TO_TRANSFER = 4

SPWillingToWalkTime

Bases: IntEnum

Willingness to walk time levels for Stated Preference Responses

Source code in data_model/enums.py
1272
1273
1274
1275
1276
1277
1278
1279
1280
class SPWillingToWalkTime(IntEnum):
    """
    Willingness to walk time levels for Stated Preference Responses
    """
    LESS_THAN_TWO_MINS = 1
    LESS_THAN_FIVE_MINS = 2
    LESS_THAN_FIFTEEN_MINS = 3
    LESS_THAN_THIRTY_MINS = 4
    NOT_INTERESTED = 5

SanBuildings

Bases: IntEnum

Integer mapping for SAN Airport buildings

Source code in data_model/enums.py
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
class SanBuildings(IntEnum):
    """
    Integer mapping for SAN Airport buildings

    """

    TERMINAL_1 = 1 
    TERMINAL_2 = 2 
    SDCRAA_ADMIN_BLDG = 3
    QHP_LIBERTY_STATION = 4 
    SDCRAA_ADC_TRAILERS = 5 
    AIRLINE_SUPPORT_BLDG_HARBOR_DRIVE = 6
    AIR_CARGO_NORTH = 7
    RENTAL_CAR_CENTER = 8
    RECEIVING_DISTRIBUTION_CENTER = 9 
    SIGNATURE_FLIGHT_SUPPORT = 10
    FACILITIES_MAINTENANCE = 11
    FBO = 12
    MENZIES = 13
    FAA = 14
    OTHER_SPECIFY = 98
    REFUSED = 99

SanFlightFrequency

Bases: IntEnum

Integer mapping for flight frequency

Source code in data_model/enums.py
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
class SanFlightFrequency(IntEnum):
    """
    Integer mapping for flight frequency
    """
    ONCE_OR_TWICE_PER_YEAR = 1
    THREE_TO_FIVE_PER_YEAR = 2
    SIX_TO_TEN_PER_YEAR = 3
    ELEVEN_TO_TWENTY_PER_YEAR = 4
    TWENTY_ONE_OR_MORE_PER_YEAR = 5
    NEVER = 6
    ALWAYS = 7 #only relevant for access mode use

ShiftTime

Bases: Enum

Source code in data_model/enums.py
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
class ShiftTime(Enum):
    class TimeRange:
        """ Make time ranges for categorization."""

        def __init__(self, lower_military_time, upper_military_time):
            self.lower_military_time = lower_military_time
            self.upper_military_time = upper_military_time

        def __str__(self):
            lower_clock_time = military_to_clock(self.lower_military_time)
            upper_clock_time = military_to_clock(self.upper_military_time)
            return f"{lower_clock_time} - {upper_clock_time}"

    ZERO_TO_ZERO_THIRTY = TimeRange("0000", "0030")
    ZERO_THIRTY_TO_ZERO_ONE = TimeRange("0030", "0100")
    ZERO_ONE_TO_ZERO_ONE_THIRTY = TimeRange("0100", "0130")
    ZERO_ONE_THIRTY_TO_ZERO_TWO = TimeRange("0130", "0200")
    ZERO_TWO_TO_ZERO_TWO_THIRTY = TimeRange("0200", "0230")
    ZERO_TWO_THIRTY_TO_ZERO_THREE = TimeRange("0230", "0300")
    ZERO_THREE_TO_ZERO_THREE_THIRTY = TimeRange("0300", "0330")
    ZERO_THREE_THIRTY_TO_ZERO_FOUR = TimeRange("0330", "0400")
    ZERO_FOUR_TO_ZERO_FOUR_THIRTY = TimeRange("0400", "0430")
    ZERO_FOUR_THIRTY_TO_ZERO_FIVE = TimeRange("0430", "0500")
    ZERO_FIVE_TO_ZERO_FIVE_THIRTY = TimeRange("0500", "0530")
    ZERO_FIVE_THIRTY_TO_ZERO_SIX = TimeRange("0530", "0600")
    ZERO_SIX_TO_ZERO_SIX_THIRTY = TimeRange("0600", "0630")
    ZERO_SIX_THIRTY_TO_ZERO_SEVEN = TimeRange("0630", "0700")
    ZERO_SEVEN_TO_ZERO_SEVEN_THIRTY = TimeRange("0700", "0730")
    ZERO_SEVEN_THIRTY_TO_ZERO_EIGHT = TimeRange("0730", "0800")
    ZERO_EIGHT_TO_ZERO_EIGHT_THIRTY = TimeRange("0800", "0830")
    ZERO_EIGHT_THIRTY_TO_ZERO_NINE = TimeRange("0830", "0900")
    ZERO_NINE_TO_ZERO_NINE_THIRTY = TimeRange("0900", "0930")
    ZERO_NINE_THIRTY_TO_ZERO_TEN = TimeRange("0930", "1000")
    TEN_TO_TEN_THIRTY = TimeRange("1000", "1030")
    TEN_THIRTY_TO_ELEVEN = TimeRange("1030", "1100")
    ELEVEN_TO_ELEVEN_THIRTY = TimeRange("1100", "1130")
    ELEVEN_THIRTY_TO_NOON = TimeRange("1130", "1200")
    NOON_TO_TWELVE_THIRTY = TimeRange("1200", "1230")
    TWELVE_THIRTY_TO_THIRTEEN_HUNDRED = TimeRange("1230", "1300")
    THIRTEEN_HUNDRED_TO_THIRTEEN_THIRTY = TimeRange("1300", "1330")
    THIRTEEN_THIRTY_TO_FOURTEEN_HUNDRED = TimeRange("1330", "1400")
    FOURTEEN_HUNDRED_TO_FOURTEEN_THIRTY = TimeRange("1400", "1430")
    FOURTEEN_THIRTY_TO_FIFTEEN_HUNDRED = TimeRange("1430", "1500")
    FIFTEEN_HUNDRED_TO_FIFTEEN_THIRTY = TimeRange("1500", "1530")
    FIFTEEN_THIRTY_TO_SIXTEEN_HUNDRED = TimeRange("1530", "1600")
    SIXTEEN_HUNDRED_TO_SIXTEEN_THIRTY = TimeRange("1600", "1630")
    SIXTEEN_THIRTY_TO_SEVENTEEN_HUNDRED = TimeRange("1630", "1700")
    SEVENTEEN_HUNDRED_TO_SEVENTEEN_THIRTY = TimeRange("1700", "1730")
    SEVENTEEN_THIRTY_TO_EIGHTEEN_HUNDRED = TimeRange("1730", "1800")
    EIGHTEEN_HUNDRED_TO_EIGHTEEN_THIRTY = TimeRange("1800", "1830")
    EIGHTEEN_THIRTY_TO_NINETEEN_HUNDRED = TimeRange("1830", "1900")
    NINETEEN_HUNDRED_TO_NINETEEN_THIRTY = TimeRange("1900", "1930")
    NINETEEN_THIRTY_TO_TWENTY_HUNDRED = TimeRange("1930", "2000")
    TWENTY_HUNDRED_TO_TWENTY_THIRTY = TimeRange("2000", "2030")
    TWENTY_THIRTY_TO_TWENTY_ONE_HUNDRED = TimeRange("2030", "2100")
    TWENTY_ONE_HUNDRED_TO_TWENTY_ONE_THIRTY = TimeRange("2100", "2130")
    TWENTY_ONE_THIRTY_TO_TWENTY_TWO_HUNDRED = TimeRange("2130", "2200")
    TWENTY_TWO_HUNDRED_TO_TWENTY_TWO_THIRTY = TimeRange("2200", "2230")
    TWENTY_TWO_THIRTY_TO_TWENTY_THREE_HUNDRED = TimeRange("2230", "2300")
    TWENTY_THREE_HUNDRED_TO_TWENTY_THREE_THIRTY = TimeRange("2300", "2330")
    TWENTY_THREE_THIRTY_TO_MIDNIGHT = TimeRange("2330", "0000")

TimeRange

Make time ranges for categorization.

Source code in data_model/enums.py
791
792
793
794
795
796
797
798
799
800
801
class TimeRange:
    """ Make time ranges for categorization."""

    def __init__(self, lower_military_time, upper_military_time):
        self.lower_military_time = lower_military_time
        self.upper_military_time = upper_military_time

    def __str__(self):
        lower_clock_time = military_to_clock(self.lower_military_time)
        upper_clock_time = military_to_clock(self.upper_military_time)
        return f"{lower_clock_time} - {upper_clock_time}"

State

Bases: IntEnum

Integer mapping for all US and Mexico States

Source code in data_model/enums.py
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
class State(IntEnum):
    """
    Integer mapping for all US and Mexico States
    """
    ALABAMA = 1
    ALASKA = 2
    AMERICAN_SAMOA = 3
    ARIZONA = 4
    ARKANSAS = 5
    CALIFORNIA = 6
    COLORADO = 7
    CONNECTICUT = 8
    DELAWARE = 9
    DISTRICT_OF_COLUMBIA = 10
    FLORIDA = 11
    GEORGIA = 12
    GUAM = 13
    HAWAII = 14
    IDAHO = 15
    ILLINOIS = 16
    INDIANA = 17
    IOWA = 18
    KANSAS = 19
    KENTUCKY = 20
    LOUISIANA = 21
    MAINE = 22
    MARYLAND = 23
    MASSACHUSETTS = 24
    MICHIGAN = 25
    MINNESOTA = 26
    MISSISSIPPI = 27
    MISSOURI = 28
    MONTANA = 29
    NEBRASKA = 30
    NEVADA = 31
    NEW_HAMPSHIRE = 32
    NEW_JERSEY = 33
    NEW_MEXICO = 34
    NEW_YORK = 35
    NORTH_CAROLINA = 36
    NORTH_DAKOTA = 37
    NORTHERN_MARIANA_ISLANDS = 38
    OHIO = 39
    OKLAHOMA = 40
    OREGON = 41
    PENNSYLVANIA = 42
    PUERTO_RICO = 43
    RHODE_ISLAND = 44
    SOUTH_CAROLINA = 45
    SOUTH_DAKOTA = 46
    TENNESSEE = 47
    TEXAS = 48
    UTAH = 49
    VERMONT = 50
    VIRGINIA = 51
    VIRGIN_ISLANDS = 52
    WASHINGTON = 53
    WEST_VIRGINIA = 54
    WISCONSIN = 55
    WYOMING = 56
    AGUASCALIENTES = 57
    BAJA_CALIFORNIA = 58
    BAJA_CALIFORNIA_SUR = 59
    CAMPECHE = 60
    CHIAPAS = 61
    CHIHUAHUA = 62
    COAHUILA = 63
    COLIMA = 64
    CIUDAD_DE_MEXICO = 65
    DURANGO = 66
    GUANAJUATO = 67
    GUERRERO = 68
    HIDALGO = 69
    JALISCO = 70
    MEXICO_STATE = 71
    MICHOACAN = 72
    MORELOS = 73
    NAYARIT = 74
    NUEVO_LEON = 75
    OAXACA = 76
    PUEBLA = 77
    QUERETARO = 78
    QUINTANA_ROO = 79
    SAN_LUIS_POTOSI = 80
    SINALOA = 81
    SONORA = 82
    TABASCO = 83
    TAMAULIPAS = 84
    TLAXCALA = 85
    VERACRUZ = 86
    YUCATAN = 87
    ZACATECAS = 88
    NOT_US_OR_MEXICO_RESIDENT = 99

SurveyLanguage

Bases: Enum

Mapping for Survey Language

Source code in data_model/enums.py
1244
1245
1246
1247
1248
1249
1250
1251
class SurveyLanguage(Enum):
    """
    Mapping for Survey Language
    """
    ENGLISH = "ENGLISH"
    SPANISH = "SPANI"
    OTHER = 98
    REFUSED = 99

Terminal

Bases: IntEnum

Integer mapping for terminals

Source code in data_model/enums.py
426
427
428
429
430
431
432
433
class Terminal(IntEnum):
    """
    Integer mapping for terminals

    """
    TERMINAL_1 = 1
    TERMINAL_2 = 2
    UNKNOWN = 99

TransitUseFrequency

Bases: IntEnum

Integer mapping for weekly transit use frequency

Source code in data_model/enums.py
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
class TransitUseFrequency(IntEnum):
    """
    Integer mapping for weekly transit use frequency
    """
    NONE = 0
    ONE_DAY = 1
    TWO_DAYS = 2
    THREE_DAYS = 3
    FOUR_DAYS = 4
    FIVE_DAYS = 5
    SIX_DAYS = 6
    SEVEN_DAYS = 7
    REFUSED = 99

TravelDuration

Bases: IntEnum

Integer Mapping for travel duration (nights away or nights visited)

Source code in data_model/enums.py
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
class TravelDuration(IntEnum):
    """
    Integer Mapping for travel duration (nights away or nights visited)
    """
    NONE = 0
    ONE = 1
    TWO = 2
    THREE = 3
    FOUR = 4
    FIVE = 5
    SIX = 6
    SEVEN = 7
    EIGHT_TO_TEN = 8
    ELEVEN_TO_FOURTEEN = 9
    MORE_THAN_FOURTEEN = 10

TravelMode

Bases: IntEnum

Mapping for all the modes used in the survey

Source code in data_model/enums.py
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
class TravelMode(IntEnum):
    """
    Mapping for all the modes used in the survey
    """
    WALK = 1
    WHEELCHAIR_OR_MOBILITY_DEVICE = 2
    BICYCLE_ELECTRIC_BIKESHARE = 3
    BICYCLE_NON_ELECTRIC_BIKESHARE = 4
    E_SCOOTER_SHARED = 5
    BICYCLE_PERSONAL_ELECTRIC = 6
    BICYCLE_PERSONAL_NON_ELECTRIC = 7
    E_SCOOTER_PERSONAL = 8
    TAXI = 9
    UBER_LYFT = 10
    CAR_SERVICE_BLACK_LIMO = 11
    DROPPED_OFF_BY_FAMILY_FRIEND = 12
    DROVE_ALONE_AND_PARKED = 13
    DROVE_WITH_OTHERS_AND_PARKED = 14
    MTS_ROUTE_992 = 15
    AIRPORT_FLYER_SHUTTLE = 16
    CHARTERED_TOUR_BUS = 17
    EMPLOYEE_SHUTTLE = 18
    RENTAL_CAR_DROPPED_OFF = 19
    RENTAL_CAR_PARKED = 20
    HOTEL_SHUTTLE_VAN = 21
    OTHER_SHARED_VAN = 22
    PICKED_UP_BY_FAMILY_FRIEND = 23
    GET_IN_PARKED_VEHICLE_AND_DRIVE_ALONE = 24
    GET_IN_PARKED_VEHICLE_AND_DRIVE_WITH_OTHERS = 25
    GET_IN_PARKED_VEHICLE_AND_RIDE_WITH_OTHER_TRAVELERS = 26
    RENTAL_CAR_PICKED_UP = 27
    RENTAL_CAR_GET_IN_PARKED = 28
    RODE_WITH_OTHER_TRAVELERS_AND_PARKED = 29
    OTHER_PUBLIC_TRANSIT = 30
    OTHER = 98
    REFUSED_NO_ANSWER = 99

TravelModeGrouped

Bases: IntEnum

Integer mapping for consolidated modes

Source code in data_model/enums.py
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
class TravelModeGrouped(IntEnum):
    """
    Integer mapping for consolidated modes
    """
    WALK = 1
    WHEELCHAIR_OR_OTHER_MOBILITY_DEVICE = 2
    MICROMOBILITY_SHARED = 3
    MICROMOBILITY_PERSONAL = 4
    RIDEHAIL_TAXI = 5
    PUBLIC_TRANSPORTATION = 6
    PERSONAL_CAR_DROPPED_OFF_PICKED_UP = 7
    PERSONAL_CAR_PARKED = 8
    SHARED_SHUTTLE_VAN = 9
    BUS_992 = 10
    AIRPORT_FLYER_SHUTTLE = 11
    RENTAL_CAR = 12
    OTHER = 98
    REFUSED_NO_ANSWER = 99

Type

Bases: IntEnum

Integer mapping for market segmentation

Source code in data_model/enums.py
28
29
30
31
32
33
34
35
36
37
class Type(IntEnum):
    """
    Integer mapping for market segmentation
    """

    PASSENGER = 1
    EMPLOYEE = 2
    NEITHER = 3
    OTHER = 98
    UNKNOWN = 99

YesNoType

Bases: IntEnum

Enum for Yes or No Type Questions

Source code in data_model/enums.py
1253
1254
1255
1256
1257
1258
1259
1260
class YesNoType(IntEnum):
    """
    Enum for Yes or No Type Questions
    """
    YES = 1
    NO = 2
    OTHER = 98
    REFUSED = 99

Utils

This section includes the Utility methods

Utility functions used with the data model.

add_enum_label_columns(df, model)

After the datamodel output is converted into a dataframe, this method adds a column to the output dataframe for each Enum variable in the datamodel. This column shows the Enum label.

Parameters:

Name Type Description Default
df DataFrame

The DataFrame to which the Enum label columns will be added.

required
model BaseModel

A Pydantic model with fields annotated with types, potentially including Enums.

required

Returns:

Type Description
DataFrame

pd.DataFrame: The modified DataFrame with additional Enum label columns.

Source code in data_model/utils.py
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
def add_enum_label_columns(df,model) -> pd.DataFrame:
    """
    After the datamodel output is converted into a dataframe, this method adds a column to the output dataframe for each Enum variable in the datamodel. This column 
    shows the Enum label.

    Args:
        df (pd.DataFrame): The DataFrame to which the Enum label columns will be added.
        model (BaseModel): A Pydantic model with fields annotated with types, potentially including Enums.

    Returns:
        pd.DataFrame: The modified DataFrame with additional Enum label columns.
    """

    for field, field_type in model.__annotations__.items():
        base_type = extract_base_type(field_type)
        if issubclass(base_type,(Enum,IntEnum)):
            enum_names = {item.value: item.name for item in base_type}
            enum_name_col = f"{field}_label" 
            df[enum_name_col] = df[field].map(enum_names).astype(str)
    return df

add_list_objects(child_list, child_key, parent_list, parent_key, parent_variable)

Maps a list of child objects to a list of parent objects. The child objects are added to the parent objects as a list using the parent_variable as the key. The child_key is used to match the child to the parent using the parent_key.

Source code in data_model/utils.py
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
def add_list_objects(
    child_list: list,
    child_key: str,
    parent_list: list,
    parent_key: str,
    parent_variable: str,
) -> list:
    """
    Maps a list of child objects to a list of parent objects. The child objects
    are added to the parent objects as a list using the `parent_variable` as the
    key. The `child_key` is used to match the child to the parent using the
    `parent_key`.
    """
    parent_to_child_map = defaultdict(dict)
    for child in child_list:
        temp_key = child[child_key]
        del child[child_key]
        parent_to_child_map[temp_key] = child

    for parent in parent_list:
        temp_key = parent[parent_key]
        parent[parent_variable] = parent_to_child_map.get(temp_key, {})

    return parent_list

add_synthetic_records(df)

Adds synthetic responses to the survey DataFrame.

Parameters:

Name Type Description Default
df DataFrame

The original DataFrame containing survey responses.

required

Returns:

Type Description
DataFrame

pd.DataFrame: A DataFrame with synthetic responses added.

Source code in data_model/utils.py
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
def add_synthetic_records(df) -> pd.DataFrame:
    """
    Adds synthetic responses to the survey DataFrame.

    Args:
        df (pd.DataFrame): The original DataFrame containing survey responses.

    Returns:
        pd.DataFrame: A DataFrame with synthetic responses added.
    """
     # Create a list to store synthetic records
    synthetic_records = []
    # Iterate through each record in the dataframe
    for index, row in df.iterrows():
        # Create a copy of the current row for the synthetic record
        if row['passenger_type'] == e.PassengerType.DEPARTING and row['initial_etc_check'] == True:
            synthetic_record = row.copy()

            # Flip inbound/outbound
            synthetic_record['respondentid'] = 'syn-' + str(row['respondentid'])
            synthetic_record['inbound_or_outbound'] = 2 if row['inbound_or_outbound'] == 1 else 1
            synthetic_record['passenger_type'] = e.PassengerType.ARRIVING
            synthetic_record['car_available'] = pd.NA
            #to-do add resident_visitor_general:
            if row['resident_visitor_general'] == e.ResidentVisitorGeneral.GOING_HOME:
                synthetic_record['resident_visitor_general'] = e.ResidentVisitorGeneral.VISITING
            elif row['resident_visitor_general'] == e.ResidentVisitorGeneral.LEAVING_HOME:
                synthetic_record['resident_visitor_general'] = e.ResidentVisitorGeneral.COMING_HOME

            if row['passenger_segment'] == e.PassengerSegment.RESIDENT_DEPARTING:
                synthetic_record['passenger_segment'] = e.PassengerSegment.RESIDENT_ARRIVING
            elif row['passenger_segment'] == e.PassengerSegment.VISITOR_DEPARTING:
                synthetic_record['passenger_segment'] = e.PassengerSegment.VISITOR_ARRIVING

            synthetic_record['previous_flight_origin'], synthetic_record['next_flight_destination'] = row['next_flight_destination'], row['previous_flight_origin']

            # Flipping the main and reverse modes:
            if pd.notna(row['reverse_mode']) and row['reverse_mode']!=e.TravelMode.REFUSED_NO_ANSWER:
                synthetic_record['main_mode'], synthetic_record['reverse_mode'] = row['reverse_mode'], row['main_mode']
            elif pd.notna(row['reverse_mode_predicted']) and row['reverse_mode_predicted']!=e.TravelMode.REFUSED_NO_ANSWER:
                synthetic_record['main_mode'], synthetic_record['reverse_mode_predicted'] = row['reverse_mode_predicted'], row['main_mode']


            synthetic_record['reverse_mode_combined'] = row['main_mode_grouped']
            #Similar for grouped modes
            if pd.notna(row['reverse_mode_grouped']) and row['reverse_mode_grouped']!=e.TravelModeGrouped.REFUSED_NO_ANSWER:
                synthetic_record['main_mode_grouped'], synthetic_record['reverse_mode_grouped'] = row['reverse_mode_grouped'], row['main_mode_grouped']
            elif pd.notna(row['reverse_mode_predicted_grouped']) and row['reverse_mode_predicted_grouped']!=e.TravelModeGrouped.REFUSED_NO_ANSWER:
                synthetic_record['main_mode_grouped'], synthetic_record['reverse_mode_predicted_grouped'] = row['reverse_mode_predicted_grouped'], row['main_mode_grouped']

            #synthetic_record['main_mode_grouped'], synthetic_record['reverse_mode_combined'] = row['reverse_mode_combined'], row['main_mode_grouped']
            # print(row['main_mode_grouped'], row['reverse_mode_combined'])


            # Access and Egress Modes:
            # synthetic_record['access_mode'], synthetic_record['egress_mode'] = row['egress_mode'], row['access_mode']
            # synthetic_record['access_mode_grouped'], synthetic_record['egress_mode_grouped'] = row['egress_mode_grouped'], row['access_mode_grouped']
            # Set access and egress modes to None
            synthetic_record["access_mode"] = None
            synthetic_record["egress_mode"] = None
            synthetic_record["access_mode_grouped"] = None
            synthetic_record["egress_mode_grouped"] = None

            # Activity Type
            synthetic_record['origin_activity_type'], synthetic_record['destination_activity_type'] = row['destination_activity_type'], row['origin_activity_type']
            synthetic_record['origin_activity_type_other'], synthetic_record['destination_activity_type_other'] = row['destination_activity_type_other'], row['origin_activity_type_other']

           #Location Attributes
            synthetic_record['origin_state'], synthetic_record['destination_state'] = row['destination_state'], row['origin_state']
            synthetic_record['origin_place_name'], synthetic_record['destination_place_name'] = row['destination_place_name'], row['origin_place_name']
            synthetic_record['origin_zip'], synthetic_record['destination_zip'] = row['destination_zip'], row['origin_zip']

            synthetic_record['origin_latitude'], synthetic_record['destination_latitude'] = row['destination_latitude'], row['origin_latitude']
            synthetic_record['origin_longitude'], synthetic_record['destination_longitude'] = row['destination_longitude'], row['origin_longitude']
            synthetic_record['origin_municipal_zone'], synthetic_record['destination_municipal_zone'] = row['destination_municipal_zone'], row['origin_municipal_zone']
            synthetic_record['origin_pmsa'], synthetic_record['destination_pmsa'] = row['destination_pmsa'], row['origin_pmsa']


            #synthetic_record['to_airport_transit_route_1'], synthetic_record['from_airport_transit_route_4'] = row['from_airport_transit_route_4'], row['to_airport_transit_route_1']
            #synthetic_record['to_airport_transit_route_2'], synthetic_record['from_airport_transit_route_3'] = row['from_airport_transit_route_3'], row['to_airport_transit_route_2']
            #synthetic_record['to_airport_transit_route_3'], synthetic_record['from_airport_transit_route_2'] = row['from_airport_transit_route_2'], row['to_airport_transit_route_3']
            #synthetic_record['to_airport_transit_route_4'], synthetic_record['from_airport_transit_route_1'] = row['from_airport_transit_route_1'], row['to_airport_transit_route_4']


            # Append the synthetic record to the list
            synthetic_record['record_type_synthetic'] = 1
            synthetic_records.append(synthetic_record)

    # Convert the list of synthetic records to a DataFrame
    synthetic_df = pd.DataFrame(synthetic_records)

    # Concatenate the original and synthetic dataframes
    combined_df = pd.concat([df, synthetic_df], ignore_index=True)

    return combined_df

extract_base_type(typ)

Extracts base type from complex annotations. This is needed to identify whether a variable is an Enum. Without this step, the origin of all the variables in the model is Annotated, even the variable is an Enum

Source code in data_model/utils.py
73
74
75
76
77
78
79
80
81
82
83
84
def extract_base_type(typ):
    """
    Extracts base type from complex annotations. This is needed to identify whether a variable 
    is an Enum. Without this step, the origin of all the variables in the model is Annotated, even the variable is an Enum
    """
    origin = get_origin(typ)
    if origin is not Enum:      
        base = get_args(typ)
        if base:
           base = extract_base_type(base[0])
           return base
    return typ

map_zones(df, lat_col, long_col, shapefile, zone_column, external_zone_value)

Maps coordinates in a DataFrame to zones defined in a shapefile.

Parameters:

Name Type Description Default
df DataFrame

Input DataFrame with latitude and longitude columns.

required
lat_col str

Column name for latitude in the DataFrame.

required
long_col str

Column name for longitude in the DataFrame.

required
shapefile str

Path to the shapefile containing zone geometries.

required
zone_column str

Column name in the shapefile that contains zone names.

required
external_zone_value Any

Value to return if a point is not within any zone in the shapefile.

required

Returns:

Type Description
GeoDataFrame

pd.GeoDataFrame: A GeoDataFrame with zone names mapped to each row.

Source code in data_model/utils.py
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
def map_zones(
    df: pd.DataFrame, 
    lat_col: str, 
    long_col: str, 
    shapefile: str, 
    zone_column: str, 
    external_zone_value: Any
) -> gpd.GeoDataFrame:
    """
    Maps coordinates in a DataFrame to zones defined in a shapefile.

    Args:
        df (pd.DataFrame): Input DataFrame with latitude and longitude columns.
        lat_col (str): Column name for latitude in the DataFrame.
        long_col (str): Column name for longitude in the DataFrame.
        shapefile (str): Path to the shapefile containing zone geometries.
        zone_column (str): Column name in the shapefile that contains zone names.
        external_zone_value (Any): Value to return if a point is not within any zone
            in the shapefile.

    Returns:
        pd.GeoDataFrame: A GeoDataFrame with zone names mapped to each row.
    """
    # Load the shapefile into a GeoDataFrame
    zones_gdf: gpd.GeoDataFrame = gpd.read_file(shapefile)

    # Ensure the shapefile has a consistent CRS (WGS84)
    zones_gdf = zones_gdf.to_crs(epsg=4326)
    data: pd.DataFrame = df.copy()
    # Add a geometry column to the DataFrame for spatial joining
    data["geometry"] = data.apply(
        lambda row: Point(row[long_col], row[lat_col]) 
        if pd.notnull(row[long_col]) and pd.notnull(row[lat_col]) else None, 
        axis=1
    )

    # Convert the DataFrame to a GeoDataFrame
    data_gdf: gpd.GeoDataFrame = gpd.GeoDataFrame(data, geometry="geometry", crs="EPSG:4326")

    # Perform a spatial join to map points to zones
    mapped_gdf: gpd.GeoDataFrame = gpd.sjoin(data_gdf, zones_gdf, how="left", predicate="within")

    # Check if the zone_column is of integer type
    is_zone_int: bool = pd.api.types.is_integer_dtype(zones_gdf[zone_column])

    # Map zone names, handling cases where coordinates are missing or no match is found
    def get_zone(row):
        if pd.isnull(row[lat_col]) or pd.isnull(row[long_col]):
            return None  # Blank if coordinates are missing
        elif pd.isnull(row[zone_column]):
            return external_zone_value # 99 for int zone_column, EXTERNAL for others
        else:
            return row[zone_column]  # Return the matched zone name

    # Apply the function to determine the zone for each row
    return mapped_gdf.apply(get_zone, axis=1)

military_to_clock(military_time)

Converts a military time string (HHMM) to a 12-hour clock format string (hh:mm AM/PM).

Parameters:

Name Type Description Default
military_time str

A string representing time in 24-hour format (e.g., “0600”).

required

Returns:

Name Type Description
str str

A string representing time in 12-hour clock format (e.g., “6:00 AM”).

Raises:

Type Description
ValueError

If the input string is not in the correct format (HHMM).

Source code in data_model/utils.py
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
def military_to_clock(military_time: str) -> str:
    """Converts a military time string (HHMM) to a 12-hour clock format string (hh:mm AM/PM).

    Args:
        military_time (str): A string representing time in 24-hour format (e.g., "0600").

    Returns:
        str: A string representing time in 12-hour clock format (e.g., "6:00 AM").

    Raises:
        ValueError: If the input string is not in the correct format (HHMM).
    """

    if not military_time.isdigit() or len(military_time) != 4:
        raise ValueError(
            "Invalid military time format. Please use HHMM format (e.g., 0600)."
        )

    hours = int(military_time[:2])
    minutes = int(military_time[2:])

    # Convert to 12-hour format
    if hours == 0:
        clock_hours = 12
        period = "am"
    elif hours >= 12:
        clock_hours = hours - 12
        period = "pm"
    else:
        clock_hours = hours
        period = "am"

    # Format the output string
    return f"{clock_hours:02d}:{minutes:02d} {period}"

nan_to_none(cls, value)

Convert nan to none to address that missing strings were being read as nan, which resulted in a value error when using using Optional[str]

Source code in data_model/utils.py
135
136
137
138
139
140
141
def nan_to_none(cls, value: Any):
    """
    Convert nan to none to address that missing strings were being read as nan, which resulted in a value error when using using Optional[str]
    """
    if value != value:
        return None
    return value