Skip to main content

KiwiRail TMS Checkdigit

A Python package for calculating the check digit of a KiwiRail TMS number.

Introduction

A TMS (Traffic Monitoring System) number is a unique identifier used by KiwiRail to track and manage their locomotives and rolling stock. The TMS number is a combination of letters and numbers, with the last digit being a check digit that is calculated using a weighted sum algorithm. This package provides a simple way to calculate the check digit of a KiwiRail TMS number.

What is a TMS Number?

A TMS number is a four-digit number that starts with a letter or letters, followed by a series of numbers. The last digit of the TMS number is a check digit that is calculated based on the preceding digits. The TMS number system was introduced in 1979 as part of the computerised Traffic Monitoring System. The system assigns unique numbers to each locomotive and piece of rolling stock, allowing for efficient tracking and management.

For example, the TMS number "DX5016" breaks down as follows:

  • "DX" is the class identifier
  • "50" is the base number
  • "1" is the check digit

The check digit is calculated using a weighted sum algorithm, which ensures that the TMS number is unique and can be verified for accuracy.

Installation

To install the package, run the following command:

pip install KiwiRail-TMS-Checkdigit

Usage

To use the package, import the tms_checkdigit module and call the calculate_check_digit function:

import KiwiRail_TMS_Checkdigit as tms

print(tms.calculate_check_digit("AMA100"))
print(tms.calculate_check_digit("AMA100"))

Testing

To run the tests, use the following command:

python setup.py test

Contributing

Contributions are welcome! Please submit a pull request with your changes.

License

This package is licensed under the MIT License.

Metadata

Release files for KiwiRail-TMS-Checkdigit 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for KiwiRail-TMS-Checkdigit 1.1.0
File Size Uploaded
kiwirail_tms_checkdigit-1.1.0.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for KiwiRail-TMS-Checkdigit 1.1.0
File Interpreter ABI Platform
kiwirail_tms_checkdigit-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / kiwirail_tms_checkdigit-1.1.0.tar.gz

Download URL kiwirail_tms_checkdigit-1.1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ac6758b9e5c49c704d6c9c720dc536bf50e116ca4d19650b461a7939e2a17472
BLAKE2b-256 checksum
How to use checksums
8a2c3c1365d4aadf32890b7cd456185e31164d40a825746dbae94d5a83a642e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / kiwirail_tms_checkdigit-1.1.0-py3-none-any.whl

Download URL kiwirail_tms_checkdigit-1.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43dcaea8da16b4a765852ad686d3defb6496a8b8786c6e978ca1f10aba107333
BLAKE2b-256 checksum
How to use checksums
50cbeda29fd47a50cb91f4908f5110901539e957afe6959975502aa7cc0eeff6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page