Skip to main content

Functions to validate National Metering Identifiers (NMIs)

Project description

NMI-Checksum

PyPI version PyPi downloads

A library to validate National Metering Identifiers (NMIs)

The validation rules are as per the Australian National Metering Identifier Procedure.

Usage

from nmicheck import nmi_checksum

checksum = nmi_checksum("QAAAVZZZZZ")
print(checksum)  # 3
from nmicheck import nmi_checksum_valid

print(nmi_checksum_valid("QAAAVZZZZZ3"))  # True
print(nmi_checksum_valid("QAAAVZZZZZ0"))  # False
from nmicheck import long_nmi, short_nmi

print(long_nmi("NMI00012345"))    # NMI000123458
print(short_nmi("NMI000123458"))  # NMI00012345

If you want to obfuscate a NMI (such as for privacy reasons) there is a helper function for that.

from nmicheck import obfuscate_nmi
print(obfuscate_nmi("NMI00012345", salt="secret"))  # 0E6816DCBA3
print(obfuscate_nmi("NMI00012345", salt="other"))   # 756C6E4B029

You can also look up the participant code for a particular NMI (which DNSP or TNSP) based on the NMI Allocation List.

from nmicheck import nmi_participant

participant = nmi_participant("6102000000")
print(participant)  # CITIPP

participant = nmi_participant("3202000000")
print(participant)  # PLINKP

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

nmicheck-0.4.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

nmicheck-0.4.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file nmicheck-0.4.0.tar.gz.

File metadata

  • Download URL: nmicheck-0.4.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nmicheck-0.4.0.tar.gz
Algorithm Hash digest
SHA256 837ced3d1c149609041f02f1cf7ba4b7a75c3c54c16e55327e4b8aa94921c0f7
MD5 a34459b8eb993a3c1c9509a3b00b4f8d
BLAKE2b-256 298b9c74a338ba434b687663879a985bb1159ba4f93e5727733c6737b9e1c391

See more details on using hashes here.

File details

Details for the file nmicheck-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: nmicheck-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nmicheck-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f498304d5f73d48a3af5554341809ff414d3aa35621576ebb9e1f263047af29c
MD5 8287de31e97a1f9232f8f8aa739acb2d
BLAKE2b-256 736b2906bd8991b59ed64ab7831afedbba00334ce126d2a48c9cde8390403e1c

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