A set of scripts for working with TransitMaster. Reference the rating process documentation here.
Effect: Different steps throughout the rating process. Allows data validation before importing into TransitMaster. Circumstances: As needed. Generally once per quarterly rating. Required Skills: None Required Tools: VPN access, Git, a text editor, access to TM databases
Reminder: Before the set-up process, clone the registered repository and make sure you're working within it.
$ brew install freetds gdal uv
$ uv python install
$ uv sync
$ cp .env.template .env
$ vi .env
$ powershell -ExecutionPolicy ByPass -c "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; irm https://astral.sh/uv/install.ps1 | iex"
$ set Path=C:\Users\%USERNAME%\.cargo\bin;%Path%
$ uv python install
$ uv sync
$ copy .env.template .env
$ notepad .env
Sync a HASTUS export to the TransitMaster server, validating the data in the process.
- Writes the data to
support/ratings/*
for later processing if needed. - Will prompt for your AD password, or you can put it in the
AD_PASSWORD
environment variable. If you have trouble logging in, setUSERNAME
to your AD account.
$ uv run python -m registered.hastus_sync
If you're testing, add --no-push
to avoid actually updating the rating data on the TM server.
For the scripts below, you will have to access the rating folder on <TRANSITMASTER_FILE_SERVER> on your local machine to direct it to the right path. If you're working from a PC computer, you are all set. If you're working from a MAC, follow the instructions below.
- From your MAC, open finder
- Click 'Go'
- Click 'Connect to Server'
- Type 'smb://<TRANSITMASTER_FILE_SERVER>/c$/Ratings'
- Access the files at '/Volumes/Ratings/[Rating]' (i.e. /Volumes/Ratings/Winter12202020)
Merge a set of rating files together in the Combine directory. This step is found under TM-03.05, step 2 in TransitMaster New Rating Procedure
Writes the merged files to <rating>.pat
, <rating>.nde
, &c.
$ uv run run python -m registered.merge <path to Rating/Combine>
Validate that the rating files are correct. This step is found under TM-03.05, step 4 (Integrity Checker) in TransitMaster New Rating Procedure
Exits with 1 if there were any errors.
$ uv run python -m registered.validate <path to Rating/Combine or Rating/Combine/HASTUS_export>
Print a CSV which has the service information for each garage, by date. This step is meant to help facilitate TM-03.05, step 7 in TransitMaster New Rating Procedure
$ uv run python -m registered.calendar <path to Rating/Combine/HASTUS_export>
Print a summary of the relevant dates/services for the rating.
$ uv run python -m registered.cheat_sheet <path to Rating/Combine/HASTUS_export>
Print a CSV which shows new/changed stops between two ratings. This step is found under TM-03.06, step 1 in TransitMaster New Rating Procedure
- Copy .env.template to .env and fill out at least the following variables with the TransitMaster DB server information from 1Password.
TRANSITMASTER_DATABASE_SERVER
TRANSITMASTER_UID
TRANSITMASTER_PWD
$ uv run python -m registered.stop_comparison <path to current Rating/Combine> <path to next Rating/Combine>
Writes an HTML file showing calculated distance/direction intervals which are not in the TransitMaster database.
This step is found under TM-03.06, step 2 in TransitMaster New Rating Procedure
- Copy .env.template to .env and fill out at least the following variables with the TransitMaster DB server information from 1Password.
TRANSITMASTER_DATABASE_SERVER
TRANSITMASTER_UID
TRANSITMASTER_PWD
$ uv run python -m registered.missing_intervals intervals.html
And then open intervals.html
in your browser.
For stop intervals:
$ uv run python -m registered.stop_intervals intervals.html --stop-id=32549