Coder Social home page Coder Social logo

npi's Introduction

This project is meant for validating National Provider Identification numbers. It started as just a tool to verify if a 10 digit number was a valid NPI, then became a tool which cleans and searches any size string for possible NPI.

Verification

This module will verify the following things, after it has cleansed the input of all non-numeric characters according to the Requirements for National Provider Identifiers

  • The NPI must be 10 characters in length
  • The NPI must only start with a 1 or 2
  • The NPI must match its check digit

Properties

  • raw: a string that represents the value being verified. This value has been cleansed of any non-numeric characters.
  • npi: a string that represents the NPI portion of the input. In otherwords, the first 9 digits of the 10 digit NPI.
  • checkDigit: a string that represents the 10th character in the input, or the check digit used to validate the first 9 digits.
  • isValid : a boolean indicating whether or not the NPI passed all validation checks.
  • npis: an array of objects with the same exact structure as it's parent. If an input length is greater than 10, it conduct a sub-string search of possible NPI within the input, and return the results here.
  • errors: an array of errors objects that describe any validation failures.
    • name: error title.
    • message: error message.
    • results: this will show the part of the input that failed.

Example

var NPI = require('../src/NPI.js')
var npi = new NPI('1234567893')
console.log('The raw input is ' + npi.raw)
console.log('The non check digits are ' +npi.npi)
console.log('The check digit is '+ npi.checkDigit)
console.log('The NPI is valid: '+ npi.isValid)

Results

The raw input is 1234567893
The non check digits are 123456789
The check digit is 3
This NPI is valid: true

Credit

Affiliation Disclosure: This project and it's contributors are in no way affiliated with the Centers for Medicare and Medicaid Services. No compensation is received for work performed on this project. This project is quite simply a tool for its contributors to hone in on their JavaScripting skills. Hope you enjoy it, and feel free to contribute.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.