Skip to content

Scanner event monitor for web-based scanning of PDF417 barcodes in healthcare setting

License

Notifications You must be signed in to change notification settings

sparkfish/scanray

Repository files navigation


Scanner events to streamline data extraction from ID cards into web-based EMRs


Scanray is a barcode scanner helper for use with web-based Electronic Medical Records (EMR) systems. With Scanray, PDF417 bardcode scanners can quickly and accurately extract the backs of Drivers Licenses and Health ID cards directly into web-based EMRs using inexpensive laser barcode scanners. Scan events are easily captured to provide extracted data elements as native Javascript objects.

It's a common need in the healthcare settings to enter patient demographics accurately and quickly. This is often entered manually or by using a TWAIN scanner to capture the details from images of these ID cards. However, using a document scanner is both slow and presents accuracy problems. Document scanners experience mechanical malfunctions frequently and require more expensive models in order to sustain high volume usage and sufficient image quality.

This sample project includes the scan capture tooling as well as a test pages for validation purposes.

Health ID Card Sample

AAMVA ID Card Sample

Browser Scan Events

When barcodes are scanned, they inject the scanned data into the keyboard stream. However, this data is not formatted in a way that is easily parsed. Further, there are key events that cause strange behaviors to occur within the browser, such as opening up the "Downloads" dialog by injecting a Ctrl+J (which also represents a line feed).

To simplify the scanning process, this packge intercepts these scan events to translate them into subscribable healthIdScan or aamvaIdScan events. When these events are triggered, you will receive a Javascript object that provides the details from the ID that are pertinent to healthcare settings.

  import Scanray from "./scanray";

  // activate passive listening to enable scan events
  Scanray.activateMonitor();

  // access values from scan event detail
  document.addEventListener("healthIdScan", (e) => {
    console.log(`healthIdScan: [${e.detail.toJson()}]`);
  });
  document.addEventListener("aamvaIdScan", (e) => {
    console.log(`aamvaIdScan: [${e.detail.toJson()}]`);
  });

Scan events capture fielded elements so that they can easily be bound to HTML forms:

Card Scanning Event

Health Identification Cards

Health ID Cards identify insurance and patient details to facilitate health care transactions and to provide input data for such transactions. Very basic insurance and patient identification information is provided on all Health ID cards. However, this information varies significantly depending on the payer with additional information being provided by various carriers.

Required fields on Health ID cards:

  • firstName
  • lastName
  • issuerId
  • cardholderId
  • cardType

Example

BCBS - Blue Cross Blue Shield

{
  "firstName":"MOSES",
  "lastName":"GARCIA",
  "middleName":"N",
  "cardType":"WH",
  "issuerId":"9118772604",
  "cardholderId":"960235001",
  "groupNumber":"8F9999",
  "issueDate":"2016-10-08",
  "rxBin":"610444",
  "rxPcn":"9999"
}

UHC - United Healthcare

{
  "firstName":"JOSE",
  "lastName":"SMITH",
  "middleName":"MARCO",
  "birthDate":"1986-06-23",
  "cardType":"WH",
  "issuerId":"9101004444",
  "cardholderId":"ZGP923333171"
}

AAMVA Identification Cards (aka Drivers Licenses)

Drivers Licenses and ID Cards produced in recent years comply with standards set forth by AAMVA to include quite a number of details about the card holder. Virtually all demographic type fields are provided by the scan events. However, not all values are extracted using this package since some details are not pertinent to the health care setting.

Example

Drivers License

{
  "firstName":"JOHN",
  "middleName":"QUINCY",
  "lastName":"PUBLIC",
  "suffix":"JR",
  "birthDate":"1970-01-31",
  "sex":"M",
  "issuerId":"636026",
  "cardType":"AAMVA-DL",
  "version":8,
  "race":"W",
  "ethnicity":"W",
  "eyeColor":"GRN",
  "hairColor":"BRO",
  "weight":"180 lb",
  "height":"069 in",
  "streetAddress1":"789 E OAK ST",
  "streetAddress2":"APT 1",
  "city":"ANYTOWN",
  "state":"CA",
  "zip":"90223",
  "country":"USA",
  "birthPlace":"OMAHA",
  "isDonor":true,
  "cardholderId":"1234567890"
}

Getting Started

Install dependencies...

npm install

...then start

npm start

Navigate to localhost:8080 to use the local test application.

Roadmap

  • Suppress browser's keyboard events that conflict with AAMVA bardcode data injected into keyboard stream
  • Parse AAMVA data elements into native javascript objects
  • Parse Health ID Card data elements into native javascript objects
  • Expose scan events and extracted data as document events (e.g, for use w/ document.addEventListener)
  • Convert from static Scanray to object instance
  • Add more options to code more parameterizable
  • Add trace level setting for console logging
  • Issue PR to onScan.js to get away from deprecated keyCode references
  • Issue PR to onScan.js to add scanStart and scanEnd events
  • Issue PR to onScan.js to track prefix from start of new scan and add requirePrefix param to onScan.isScanInProgressFor()

Credits

This library heavily relies on onScan.js by Andrej Kabachnik.

License

This is an open source project licensed under MIT.