### Install gsutil Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/compliance_track/README.md Install the gsutil command-line tool. This is used for interacting with Google Cloud Storage. ```sh pip install gsutil ``` -------------------------------- ### Install Python and Pip on macOS Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Installs Python 3.9 and Pip using Homebrew and a script. Ensure Python 3.9+ and Pip are installed before proceeding. ```sh $ python3 --version $ pip --version ``` ```sh $ brew install python3.9 $ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py $ sudo python get-pip.py ``` -------------------------------- ### Install xlsxwriter Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/compliance_track/README.md Install the xlsxwriter library for Python. This is required for generating reports. ```sh pip install xlsxwriter ``` -------------------------------- ### Install Project Requirements Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Installs project dependencies using pip after activating the virtual environment. Ensure 'requirements.txt' is present. ```sh (env) $ pip install -r requirements.txt ``` -------------------------------- ### Install GDAL and Spatialindex on macOS Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Installs GDAL and RTree (Libspatialindex) libraries using Homebrew. These are required for the GTFS Kit Library dependency. ```sh $ brew install GDAL $ brew install spatialindex ``` -------------------------------- ### Set up and Activate Python Virtual Environment Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Creates and activates a Python 3.9 virtual environment named 'env'. This is recommended before installing project requirements. ```sh $ python3.9 -m venv env $ source env/bin/activate ``` -------------------------------- ### Import Operations and Get All Sources Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Opens the Python interpreter, imports project operations, and retrieves all available transit feeds. ```python $ cd mobility-catalogs $ python >>> from tools.operations import * >>> get_sources() ``` -------------------------------- ### Get Sources by Bounding Box Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Retrieves transit feeds within a specified geographical bounding box. Coordinates should be expressed as floats. ```python >>> get_sources_by_bounding_box( minimum_latitude=$MINIMUM_LATITUDE, maximum_latitude=$MAXIMUM_LATITUDE, minimum_longitude=$MINIMUM_LONGITUDE, maximum_longitude=$MAXIMUM_LONGITUDE ) ``` -------------------------------- ### Get Sources by Feature Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Retrieves transit feeds that support a specific feature. The `$FEATURE` must be one of the allowed string values. ```python >>> get_sources_by_feature( feature=$FEATURE, ) ``` -------------------------------- ### Get Sources by Status Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Retrieves transit feeds filtered by their operational status. The `$STATUS` must be one of the allowed string values. ```python >>> get_sources_by_status( status=$STATUS, ) ``` -------------------------------- ### Get Sources by Subdivision Name Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Retrieves transit feeds filtered by a specific ISO 3166-2 subdivision name. Replace `$SUBDIVISION_NAME` with the actual subdivision code. ```python >>> get_sources_by_subdivision_name(subdivision_name=$SUBDIVISION_NAME) ``` -------------------------------- ### Get Sources by Country Code Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Retrieves transit feeds filtered by a specific ISO 3166-1 alpha-2 country code. Replace `$COUNTRY_CODE` with the actual country code. ```python >>> get_sources_by_country_code(country_code=$COUNTRY_CODE) ``` -------------------------------- ### Clone Mobility Database Catalogs Repository Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Clones the project repository from GitHub using HTTP and navigates into the project directory. ```sh $ git clone https://github.com/MobilityData/mobility-database-catalogs.git $ cd mobility-database-catalogs ``` -------------------------------- ### Add GTFS Realtime Source Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/CONTRIBUTING.md Use this operation to add a new GTFS Realtime source. Specify the entity types, provider, direct download URL, and authentication details. Static references and optional fields like license URL and source name can also be provided. ```python >>> add_gtfs_realtime_source( entity_type=[$YOUR_SOURCE_ARRAY_OF_ENTITY_TYPES], provider=$YOUR_SOURCE_PROVIDER_NAME, direct_download_url=$YOUR_SOURCE_DIRECT_DOWNLOAD_URL, authentication_type=$YOUR_SOURCE_AUTHENTICATION_TYPE, authentication_info_url=$CONDITIONALLY_REQUIRED_AUTHENTICATION_INFO_URL, api_key_parameter_name=$CONDITIONALLY_REQUIRED_API_KEY_PARAMETER_NAME, license_url=$OPTIONAL_LICENSE_URL, name=$OPTIONAL_SOURCE_NAME, static_reference=[$OPTIONAL_ARRAY_OF_STATIC_REFERENCE_NUMERICAL_IDS], note=$OPTIONAL_SOURCE_NOTE, ) ``` -------------------------------- ### Run the main compliance tracking script Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/compliance_track/README.md Execute the primary Python script for compliance tracking. This script analyzes Mobility Database feeds for best and bad practices. ```sh python3 -m compliance_track.main ``` -------------------------------- ### Add GTFS Schedule Source Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/CONTRIBUTING.md Use this operation to add a new GTFS Schedule source. Provide all necessary details about the source, including direct download URL and authentication information if applicable. API authentication requires using a specific form if authentication_type is 1 or 2. ```python >>> add_gtfs_schedule_source( provider=$YOUR_SOURCE_PROVIDER_NAME, country_code=$YOUR_SOURCE_COUNTRY_CODE, direct_download_url=$YOUR_SOURCE_DIRECT_DOWNLOAD_URL, authentication_type=$OPTIONAL_AUTHENTICATION_TYPE, authentication_info_url=$CONDITIONALLY_REQUIRED_AUTHENTICATION_INFO_URL, api_key_parameter_name=$CONDITIONALLY_REQUIRED_API_KEY_PARAMETER_NAME, api_key_parameter_value=$NOT_STORED_API_KEY_PARAMETER_VALUE, subdivision_name=$OPTIONAL_SUBDIVISION_NAME, municipality=$OPTIONAL_MUNICIPALITY, license_url=$OPTIONAL_LICENSE_URL, name=$OPTIONAL_SOURCE_NAME, features=[$OPTIONAL_FEATURE_ARRAY], status=$OPTIONAL_STATUS, feed_contact_email=$OPTIONAL_FEED_CONTACT_EMAIL, redirects=[ { "id": $OPTIONAL_REDIRECT_ID, "comment": $OPTIONAL_REDIRECT_COMMENT } ], ) ``` -------------------------------- ### Clone Repository Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/CONTRIBUTING.md Clone the Mobility Database Catalogs repository to your local machine using the HTTPS protocol. ```git git clone https://github.com/MobilityData/mobility-database-catalogs.git ``` -------------------------------- ### Run the detailed compliance report script Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/compliance_track/README.md Execute a Python script to generate a detailed report on specific practices under discussion. This provides in-depth information beyond the main compliance tracking. ```sh python3 -m compliance_track.details ``` -------------------------------- ### Push Contribution to Origin Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/CONTRIBUTING.md Push your contribution to your branch on the origin repository. ```git git push origin $YOUR_NEW_BRANCH ``` -------------------------------- ### Add Contribution Files to Staging Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/CONTRIBUTING.md Add your contribution files or the directory containing modifications to the git staging area. ```git git add $YOUR_FILES ``` -------------------------------- ### Copy reports from Google Cloud Storage Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/compliance_track/README.md Copy reports from a specified Google Cloud Storage bucket and path to the local directory. Ensure you are in the root directory of the mobility-database-catalog repository and have activated your virtual environment. ```sh gsutil -m cp -r "gs://mobilitydata-gtfs-validation-results/reports/2023-06-06T02:45/cebc62a4-ed30-4d1b-9816-53b3376baabc" . ``` -------------------------------- ### Commit Contribution Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/CONTRIBUTING.md Commit your contribution with a message explaining the changes made. ```git git commit -m "$YOUR_COMMIT_MESSAGE" ``` -------------------------------- ### Create New Branch Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/CONTRIBUTING.md Create a new branch for your contribution. You can list existing branches with `git branch -a` to ensure your branch name is unique. ```git git checkout -b $YOUR_NEW_BRANCH ``` -------------------------------- ### Deactivate Python Virtual Environment Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/README.md Exits the currently active Python virtual environment. ```sh (env) $ deactivate ``` -------------------------------- ### Update GTFS Realtime Source Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/CONTRIBUTING.md Use the `update_gtfs_realtime_source` operation to modify GTFS Realtime source parameters. Note that `mdb_source_id` and `data_type` are immutable. ```python >>> update_gtfs_realtime_source( mdb_source_id=$YOUR_SOURCE_NUMERICAL_ID, entity_type=[$YOUR_SOURCE_ARRAY_OF_ENTITY_TYPES], provider=$YOUR_SOURCE_PROVIDER_NAME, direct_download_url=$YOUR_SOURCE_DIRECT_DOWNLOAD_URL, authentication_type=$YOUR_SOURCE_AUTHENTICATION_TYPE, authentication_info_url=$CONDITIONALLY_REQUIRED_AUTHENTICATION_INFO_URL, api_key_parameter_name=$CONDITIONALLY_REQUIRED_API_KEY_PARAMETER_NAME, license_url=$OPTIONAL_LICENSE_URL, name=$OPTIONAL_SOURCE_NAME, static_reference=[$OPTIONAL_ARRAY_OF_STATIC_REFERENCE_NUMERICAL_IDS], note=$OPTIONAL_SOURCE_NOTE, ) ``` -------------------------------- ### Update GTFS Schedule Source Source: https://github.com/mobilitydata/mobility-database-catalogs/blob/main/CONTRIBUTING.md Use this operation to update an existing GTFS Schedule source. Provide the source's numerical ID and any parameters you wish to change. Note that `mdb_source_id` and `data_type` cannot be updated. API authentication updates follow specific guidelines. ```python >>> update_gtfs_schedule_source( mdb_source_id=$YOUR_SOURCE_NUMERICAL_ID, provider=$OPTIONAL_SOURCE_PROVIDER_NAME, name=$OPTIONAL_SOURCE_NAME, country_code=$OPTIONAL_SOURCE_COUNTRY_CODE, subdivision_name=$OPTIONAL_SOURCE_SUBDIVISION_NAME, municipality=$OPTIONAL_SOURCE_MUNICIPALITY, direct_download_url=$OPTIONAL_SOURCE_DIRECT_DOWNLOAD_URL, authentication_type=$OPTIONAL_AUTHENTICATION_TYPE, authentication_info_url=$CONDITIONALLY_REQUIRED_AUTHENTICATION_INFO_URL, api_key_parameter_name=$CONDITIONALLY_REQUIRED_API_KEY_PARAMETER_NAME, api_key_parameter_value=$NOT_STORED_API_KEY_PARAMETER_VALUE, license_url=$OPTIONAL_LICENSE_URL, features=[$OPTIONAL_FEATURE_ARRAY], status=$OPTIONAL_STATUS, feed_contact_email=$OPTIONAL_FEED_CONTACT_EMAIL, redirects=[ { "id": $OPTIONAL_REDIRECT_ID, "comment": $OPTIONAL_REDIRECT_COMMENT } ], ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.