Skip to main content

A package for calculating the check digit of a TMS number

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kiwirail_tms_checkdigit-1.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kiwirail_tms_checkdigit-1.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file kiwirail_tms_checkdigit-1.1.0.tar.gz.

File metadata

  • Download URL: kiwirail_tms_checkdigit-1.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for kiwirail_tms_checkdigit-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ac6758b9e5c49c704d6c9c720dc536bf50e116ca4d19650b461a7939e2a17472
MD5 0d18f1d8f8f87a218457fac077e915cb
BLAKE2b-256 8a2c3c1365d4aadf32890b7cd456185e31164d40a825746dbae94d5a83a642e6

See more details on using hashes here.

File details

Details for the file kiwirail_tms_checkdigit-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kiwirail_tms_checkdigit-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43dcaea8da16b4a765852ad686d3defb6496a8b8786c6e978ca1f10aba107333
MD5 b9fe5a12835ac2939d2a03f577a1d0bc
BLAKE2b-256 50cbeda29fd47a50cb91f4908f5110901539e957afe6959975502aa7cc0eeff6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page