Tcl Library Source Code

Documentation
Login


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

valtype::usnpi - Validation for USNPI

Table Of Contents

SYNOPSIS

package require Tcl 8.5 9
package require snit 2
package require valtype::common
package require valtype::luhn
package require valtype::usnpi ?1.1?

valtype::usnpi validate value
valtype::usnpi checkdigit value

DESCRIPTION

This package implements a snit validation type for an USNPI.

A validation type is an object that can be used to validate Tcl values of a particular kind. For example, snit::integer, a validation type defined by the snit package is used to validate that a Tcl value is an integer.

Every validation type has a validate method which is used to do the validation. This method must take a single argument, the value to be validated; further, it must do nothing if the value is valid, but throw an error if the value is invalid:

valtype::usnpi validate .... ;# Does nothing
valtype::usnpi validate .... ;# Throws an error (bad US National Provider Identifier (US-NPI) number).

The validate method will always return the validated value on success, and throw the -errorcode INVALID on error, possibly with additional elements which provide more details about the problem.

API

The API provided by this package satisfies the specification of snit validation types found in the documentation of Snit's Not Incr Tcl.

Error Codes

As said in the package description, the errors thrown by the commands of this package in response to input validation failures use the -errorcode INVALID to distinguish themselves from package internal errors.

To provide more detailed information about why the validation failed the -errorCode goes actually beyond that. First, it will contain a code detailing the type itself. Here this is USNPI. This is then followed by values detailing the reason for the failure. The full set of __-errorCode__s which can be thrown by this package are:

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category valtype of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

KEYWORDS

Checking, NPI, National Provider Identifier, Testing, Type checking, US-NPI, Validation, Value checking, isA, medicare

CATEGORY

Validation, Type checking

COPYRIGHT

Copyright © 2011 Andreas Kupries