caf.ntem.structure#

Defines the structures of the database tables.

Module Attributes

DB_TO_ACCESS_TABLE_LOOKUP

Lookup between database tables and MS Access table names.

ACCESS_TO_DB_COLUMNS

Lookup between MS Access columns and database columns.

LOOKUP_TABLES

List of lookup tables.

Functions

connection_string(path[, driver_name])

Create a connection string to the database.

query_to_dataframe(conn, query, *[, ...])

Query database using an sqlalchemy query and returns a dataframe.

schema_connection_string(output_path)

Create a connection string to the database.

Classes

Base(**kwargs)

Base class for metadata tables.

CarAvailabilityTypes(**kwargs)

Lookup Table for car availability types.

CarOwnership(**kwargs)

Table for car ownership data.

CarOwnershipTypes(**kwargs)

Lookup Table for car ownership types.

GeoLookup(**kwargs)

Lookup Table between zoning systems.

MetaData(**kwargs)

Metadata table for the database.

ModeTypes(**kwargs)

Lookup Table for mode types.

NtemTripTypeLookup([production_trip_end, ...])

Table for Trip type lookup.

Planning(**kwargs)

Table for planning data.

PlanningDataTypes(**kwargs)

Lookup Table for planning data types.

PurposeTypes(**kwargs)

Lookup Table for purpose types.

TimePeriodTypes(**kwargs)

Lookup Table for time period types.

TripEndDataByCarAvailability(**kwargs)

Table for trip end data by car availability.

TripEndDataByDirection(**kwargs)

Table for trip end data by direction.

TripType(**kwargs)

Lookup Table for trip types.

ZoneType(**kwargs)

Zone system table.

Zones(**kwargs)

Zoning definition table.

Attributes Documentation

caf.ntem.structure.DB_TO_ACCESS_TABLE_LOOKUP: dict[str, str] = {'authority': 'tblLookupAuthority82', 'car_availability_types': 'tblLookUpCarAvailability', 'car_ownership_types': 'tblLookUpCarOwnershipType', 'county': 'tblLookupCounty83', 'mode_types': 'tblLookUpTransport', 'ntem_zoning': 'tblLookupGeo83', 'planning': 'Planning', 'planning_data_types': 'tblLookUpPlanning83', 'purpose_types': 'tblLookUpTripPurpose', 'region': 'tblLookupRegion', 'time_period_types': 'tblLookUpTimePeriod', 'trip_type': 'NtemTripTypeLookup'}#

Lookup between database tables and MS Access table names.

caf.ntem.structure.ACCESS_TO_DB_COLUMNS: dict[str, dict[str, str]] = {'authority': {'AuthorityID': 'ntem_zoning_id', 'AuthorityName': 'name', 'ControlAreaID': 'source_id_or_code'}, 'car_availability_types': {'CarAvDesc': 'name', 'CarAvID': 'id'}, 'car_ownership_types': {'CarOwnDesc': 'name', 'CarOwnID': 'id'}, 'county': {'CountyID': 'ntem_zoning_id', 'CountyName': 'name'}, 'mode_types': {'TransportDesc': 'name', 'TransportID': 'id'}, 'ntem_zoning': {'AuthorityID': 'authority_id', 'CountyID': 'county_id', 'NTEM7ZoneCode': 'source_id_or_code', 'RegionID': 'region_id', 'TemproZoneID': 'ntem_zoning_id', 'ZoneName': 'name'}, 'planning_data_types': {'PlanDesc': 'name', 'PlanID': 'id'}, 'purpose_types': {'PurposeDesc': 'name', 'PurposeID': 'id'}, 'region': {'LongRegionName': 'name', 'RegionID': 'ntem_zoning_id', 'RegionName': 'source_id_or_code'}, 'time_period_types': {'DivideBy': 'divide_by', 'TimePeriodDesc': 'name', 'TimePeriodID': 'id'}, 'trip_type': {'TEtypeDesc': 'name', 'TEtypeID': 'id'}}#

Lookup between MS Access columns and database columns.

caf.ntem.structure.LOOKUP_TABLES: list[type[Base]] = [<class 'caf.ntem.structure.CarAvailabilityTypes'>, <class 'caf.ntem.structure.CarOwnershipTypes'>, <class 'caf.ntem.structure.ModeTypes'>, <class 'caf.ntem.structure.PurposeTypes'>, <class 'caf.ntem.structure.TimePeriodTypes'>, <class 'caf.ntem.structure.TripType'>, <class 'caf.ntem.structure.PlanningDataTypes'>]#

List of lookup tables.