Roster Mapper

Provider rosters come in different shapes and formats. Roster Mapper maps any roster file to a canonical schema, standardizes values against public sources, and produces a clean change file for your roster directory.

How it works

  1. ReadEvery sheet of an xlsx, xls or csv into rows. SSNs are removed as the file is read.
  2. MapFind the header row, match columns to the schema, detect the action (add, update, term) and category.
  3. StandardizeDates, NPIs, tax IDs, ZIPs, phones, states and names into one format; rows that can't move forward are left out, with the reason.
  4. ValidateNPIs against NPPES, addresses against the US Census geocoder.
  5. ReviewProviders, practice locations and billing entities, and how they connect.
  6. ExportOne workbook per sheet: Summary, Mapping, Data, Issues and Left out.

Each step is described in Processing steps.

Usage

Needs Node 22 or later. Roster Mapper has three ways in, all running the same steps:

Command line

npm install -g rostermapper
rostermapper roster.xlsx                 # every step; saves output/RM_roster_<sheet>.xlsx
rostermapper roster.xlsx --steps         # one step at a time, printing each step's result
rostermapper inbox/                      # every roster in the folder: output/<date-time>/ with summary.xlsx
rostermapper a.xlsx b.xlsx -o results/   # several files: results/<date-time>/
rostermapper roster.xlsx -o result.xlsx  # every sheet in one workbook
rostermapper roster.xlsx -o clean.csv    # the records; rows left out, and why, in clean_issues.csv
rostermapper roster.xlsx --ui            # open the UI with the file loaded
rostermapper                             # open the UI and upload files there
rostermapper fields                      # the data dictionary
rostermapper --help                      # every option

What the terminal shows: each sheet's action, category and columns mapped, and how many rows moved forward, were left out and have issues. The details are in the workbook (see Export). --why prints the mapping and the reasons behind it; --json prints the whole result.

Options: -s sheet, -a action (add, update, term), -c category (individual, facility), --header-row, --effective-date, --contract-id, --sender-email, --allow (keep a sender's own codes as written, like --allow provider_type=AHP,PHYS), -m mapping file, -o output, --no-nppes, --no-census, --no-cache, --keep-dropped, --steps, --why, --json, --ui. rostermapper --help explains each.

The exit code is 1 when the arguments are wrong, a file can't be read, or (in a batch) any file failed.

Step by step (debugging a roster)

--steps runs the same pipeline but stops after each step to print what it did:

In a terminal it waits for Enter before the next step; q stops. Piped, it prints every step without waiting.

UI

rostermapper --ui (or rostermapper with no file, in a terminal) serves the UI on 127.0.0.1 and opens it. Only this machine can connect; files are read in the browser, and only NPIs and addresses go out, through the local server, to NPPES and the Census geocoder. Set PORT to choose the port and BROWSER=none to not open a browser.

Every change recalculates live, and each sheet keeps its changes when you switch between them. The status bar shows progress and the open sheet's counts.

Library

npm install rostermapper

Three entry points:

Import What it has Runs in
rostermapper The pipeline (runSheets, STEPS) and every step's functions: automap, cleanValue, validateRecords, groupEntities, reportTables, toCsv, … No I/O. Node and the browser
rostermapper/workbook readWorkbook (xlsx, xls, csv bytes → sheets, SSNs removed) and Excel output: toReport, sheetWorkbooks, toBatchSummary, toZip. Bundles SheetJS. Node and the browser
rostermapper/node What the command line runs: mapFile, mapFiles, writeOutput, live NPPES and Census lookups with the disk cache. Node

The command line's default run, from code:

import { mapFile, writeOutput } from 'rostermapper/node';

const { file, results } = await mapFile('roster.xlsx');   // read, map, standardize, validate, review
writeOutput(file, results, 'output');                     // output/RM_roster_<sheet>.xlsx

A folder, as rostermapper inbox/ does:

import { mapFiles } from 'rostermapper/node';

const { dir, entries } = await mapFiles(['inbox/'], { output: 'output' });   // entries: one per sheet, as in summary.xlsx

Without lookups, in the browser or anywhere else:

import { runSheets, toCsv } from 'rostermapper';
import { readWorkbook } from 'rostermapper/workbook';

const sheets = readWorkbook(bytes);                      // ArrayBuffer or Uint8Array
const results = await runSheets('roster.xlsx', sheets);  // pass { lookup } to validate
const csv = toCsv(results.flatMap((r) => r.records));

Options for runSheets, mapFile and mapFiles match the command line's flags: action, category, headerRow, overrides (from parseMapping), constants ({ 'network.contract_id': '…' }), effectiveDate, sources ({ nppes, census }), lookup (your own LookupFns, or false in Node for none). onStep is called after each step with that step's result; return false to stop. Each result is a sheet's mapping (each column, its field and why), its records (one per row, every field and its issues), the detected action and category, missing required fields and suggestions. See src/index.ts for the full API.

Embedding the UI

The UI in dist/ui/ is plain HTML, CSS and ES modules, styled for embedding in another page (an admin portal): its CSS is layout only, scoped to .rm, and takes fonts, text colour, buttons and inputs from the page around it. The <style> block in index.html plays the host page when the command line serves it; drop it when embedding. The host can set:

Variable Default What it sets
--rm-accent LinkText Current step, header row, highlights
--rm-bg Canvas Background behind sticky headers and the status bar
--rm-max-width none The bench's width
--rm-min-height 100vh Its height, so the status bar sits at the bottom

The UI needs a server for three things browsers can't do alone: /api/nppes, /api/census and /api/nppes-name (NPPES and the Census geocoder have no CORS). answerLookup in src/validate/lookup.ts answers all three; see src/cli/server.ts, or the demo site's function in demo/netlify/functions/.

A host can also open a roster in the page and take the result back. The page fetches these relative to itself, each with the page's own query string added, so index.html?attachment=8f2c… tells the host which roster:

Route Answer What the page does
GET session JSON: Session in src/cli/server.ts (name, sheet, action, inputs, send, samples, home, …), or {} With name, opens that roster; without, starts at Upload. samples ([{ file, title?, note? }]) lists rosters under the drop, each opening ?sample=<file>; home (a URL) makes the title a link back to the host's site
GET file The roster's bytes (xlsx, xls or csv), or the sheets already read (JSON, as the CLI sends) Reads bytes like an upload, removing SSNs as it reads
GET mapping A mapping file's bytes, when session.mappingName is set Applies the overrides
POST send JSON: { message?, open? }, or an error status with { error } Shown when session.send is { label }: a button with that label next to Download

send gets the open file's sheets that aren't ignored, with Contract ID and sender email written in:

{ "name": "roster.xlsx", "checked": "NPPES, Census",
  "sheets": [{ "sheet": "Adds", "headerRow": 1, "action": "ADD", "category": "individual",
               "mapping": { "provider.npi": "NPI #", "…": "…" },
               "counts": { "rows": 40, "movedForward": 38, "leftOut": 2, "withIssues": 5 },
               "records": [{ "row": 2, "values": { "provider.npi": "…" }, "issues": [] }] }] }

records are every row, left-out ones included, each with the issues that dropped it (drop: true), so the host can account for every line the sender sent. The page shows message, then goes to open (the top window's location when it is framed).

From the command line, --send <url> with --ui adds the button and passes the POST on to that URL, with the page's query string: rostermapper --ui roster.xlsx --send "http://localhost:8768/api/mapper".

Processing steps

Every roster goes through the same six steps, from the command line and from the UI: both run runSheets on the same code. Each step's code lives in its own folder under src/.

Step Code What it does
1. Read src/read/ Reads any xlsx, xls or csv into sheets of rows; removes SSNs
Transform not built Reshape when needed: wide files with several locations per row become one row per location
2. Map src/map/ Finds the header row, matches columns to schema fields, detects the action and category
3. Standardize src/standardize/ Cleans each value into its standard format; marks rows that can't move forward
4. Validate src/validate/ Checks NPIs with NPPES and addresses with the US Census geocoder
5. Review src/review/ Groups rows into providers, practice locations and billing entities
6. Export src/export/ Writes a workbook per sheet: Summary, Mapping, Data, Issues and Left out

To see what each step did to a roster, run it one step at a time: rostermapper roster.xlsx --steps prints each step's result and waits for Enter between steps. See Usage.

1. Read

Options that apply to the whole run (UI: New run; CLI: flags):

Transform (not built yet)

Planned: a decision model runs through a series of questions to determine what transformations, if any, a sheet needs.

2. Map

Columns not mapped are grouped as suggested, no match, other addresses (need a transform) and ignored. Numbered or repeated headers ("Alt City 1–4") fold into one chip in the UI.

3. Standardize

Each value is put in its field's format:

In the UI, "edit" on an issue types the right value for its rows; Raw data shows the sheet as it is in the file.

Rows left out

A row that can't move forward is left out of the output's Data and listed, with the reason, on Left out (or in <name>_issues.csv with -o file.csv). The output plus the rows left out always add up to every row. A row is left out when:

A row with no practice address is kept and flagged as missing it; it just has no practice location (a location name alone isn't a place). --keep-dropped writes left-out rows to Data too.

4. Validate

Only outside sources, and only the ones turned on (--no-nppes, --no-census; the UI's External sources). Only an NPI, a provider's name or an address line is sent.

What's applied without asking (trusted): the Census geocoder's city, state, ZIP and suite on line 2, and NPPES's legal name for a billing NPI, with entity types shortened (Professional Limited Liability Company → PLLC). A legal name sharing no word with the roster's is only suggested, with a warning. A blank legal name is filled from NPPES when the billing NPI is an active organization NPI (NPPES is looked up by NPI; it doesn't publish tax IDs). A blank taxonomy is filled with the provider's primary taxonomy in NPPES; a taxonomy the roster has is kept, and NPPES's is only suggested. In the UI, "undo" puts the roster's value back.

What's only suggested: NPPES's credential and taxonomy (NPPES is often slow to update them; the roster's value is kept and a difference isn't an issue), and small name, gender and license differences (a typo, a nickname). Large differences are issues: one name nothing like NPPES's, or first and last name swapped. When both names are unlike NPPES's, the NPI belongs to someone else and the row is left out. When a provider's NPI is under another last name, NPPES is searched by the roster's name; if it has the provider under another NPI, the row is left out with that NPI suggested ("Use" in the UI puts it in and keeps the row).

Lookups run 4 at a time, retry when rate-limited, and are kept between runs in ~/.cache/rostermapper/lookups.json (NPPES answers for 7 days, Census for 90; readable only by you). --no-cache looks everything up again; delete the file to clear it. Bulk work should use the monthly NPPES file instead.

5. Review

Rows grouped into what they describe: unique providers (by NPI), practice locations (by address) and billing entities (by TIN, group NPI and address), and which provider works where and bills through whom. The UI shows them as a table of provider × location × billing combinations or as a graph, with every issue once per entity and its fix. --steps prints the counts.

6. Export

The default output is one workbook per sheet, RM_<file>_<sheet>.xlsx, with five tabs:

Tab What it holds
Summary The file, the lookups used, and per sheet: header row, action and category (and why), columns mapped, rows moved forward, left out and with issues
Mapping Each column, the field it went to (or why not), its score and why; then required fields no column holds
Data The rows that move forward, one record per row (see below)
Issues One line per problem, on every row, with whether the row was left out
Left out Each row left out, the reason, other issues, and its values, so it can be fixed and sent again

The name: RM marks Roster Mapper output, then the roster's name without its extension and the sheet name, each with spaces dropped: Q3 Roster.xlsx, sheet LOC TERM → RM_Q3Roster_LOCTERM.xlsx. When that name is taken, the time is added (_20261117-143005).

Given several files or a folder, each is mapped as on its own into a new folder for the run, output/<date-time>/, so a batch never mixes with or overwrites another. summary.xlsx there has one line per sheet (action, category, rows moved forward and left out, its workbook) and one per file that couldn't be mapped, and why. A failed file doesn't stop the batch. In a folder, Excel lock files (~$…), hidden files and Roster Mapper's own output (RM_…, summary.xlsx) are skipped; subfolders aren't read. The UI's "Download all" gives the same files in a zip.

Other formats: -o file.xlsx puts every sheet in one workbook; -o file.csv or -o file.json writes the records, with the rows left out in <name>_issues.csv.

Records

One record per row, every field present (empty when the file has no value). Columns in order: the file fields, then the network fields (action, effective date, …), then provider, practice and billing fields, then issues. Fields marked hidden in the schema (CAQH ID, email, website, location type, BH, note) are left out unless a record has a value for them. See Canonical fields.

The file fields are set once per sheet and written into every record:

Field What it holds
file.name File name and extension
file.sheet Sheet name
file.action adds, terms, update or mixed (rows with different actions): set by the user, otherwise detected
file.category individual or facility: set with --category, else facility when the sheet or file name says so, else individual when a column holds the provider's NPI, name, birth date or gender, else facility when only a practice or billing organization is named

Data sources

Roster Mapper checks rosters against three public sources. NPPES and the US Census geocoder are looked up live, in Validate, and only an NPI, a provider's name or an address line is sent to them. The NUCC taxonomy ships with Roster Mapper, so checking a taxonomy code sends nothing.

NPPES

The NPI Registry from CMS (the National Plan and Provider Enumeration System) lists every NPI with its owner's name, type, taxonomy, license and addresses.

US Census geocoder

The Census Geocoder from the US Census Bureau matches a street address to the Census street ranges.

NUCC

The NUCC Health Care Provider Taxonomy from the National Uniform Claim Committee is the code set for provider types and specialties (207Q00000X is Family Medicine).

Schema

One record per roster row, every field present (empty when the file has no value). The file fields come first, then the network, provider, practice and billing fields. The CSV export adds row after the file fields and issues last.

File

Set once per sheet, not mapped from columns, and written into every record. The name and sheet also name the output file: RM_<file>_<sheet>.csv, both with their spaces dropped (Q3 Roster.xlsx, sheet LOC TERM → RM_Q3Roster_LOCTERM.csv).

Field Description Type Format / values
file.name File name and extension string
file.sheet Selected sheet name string
file.action The file action: set by the user, otherwise detected (see Action) enum adds, terms, update, mixed
file.category Whether the sheet lists individual providers or facilities enum individual or facility

Provider

Field Description Type Format / values
provider.npi Rendering provider's individual (Type 1) National Provider Identifier digits 10 digits, valid check digit
provider.first_name Legal first name string
provider.middle_name Middle name or middle initial string
provider.last_name Legal last name string
provider.suffix Generational suffix string Jr, Sr, II, IV
provider.degree Credentials, comma-separated if more than one string MD, DO, NP
provider.gender Gender enum M or F
provider.date_of_birth Date of birth date YYYY-MM-DD
provider.taxonomy_1 Primary NUCC taxonomy code string 10 characters, e.g. 207Q00000X
provider.taxonomy_2 Secondary NUCC taxonomy code string 10 characters
provider.specialty_1 Primary specialty string derived from taxonomy_1 when missing
provider.specialty_2 Secondary specialty string derived from taxonomy_2 when missing
provider.license_state State that issued the license enum 2-letter state, e.g. TX
provider.license_number State license number string
provider.license_expiration_date State license expiration date date YYYY-MM-DD
provider.dea_number DEA registration number string 2 letters + 7 digits
provider.dea_expiration_date DEA registration expiration date date YYYY-MM-DD
provider.caqh_id CAQH ProView provider ID digits
provider.email Provider's email address string

Practice location

Field Description Type Format / values
practice.dba Public name of the practice (doing business as) string
practice.location_name Site, location or clinic name, if different from the DBA string
practice.address_1 Street address of the service location string
practice.address_2 Suite, unit or floor string
practice.city City of the service location string
practice.state State of the service location enum 2-letter state, e.g. TX
practice.zip ZIP code of the service location digits XXXXX
practice.phone Phone number for this location digits XXX-XXX-XXXX
practice.fax Fax number for this location digits XXX-XXX-XXXX
practice.website Public website, if available string

Billing entity

Field Description Type Format / values
billing.tax_id Federal tax ID (TIN) as it appears on the W-9 digits XX-XXXXXXX
billing.legal_name Legal name of the tax ID (W-9) string often ends in PLLC, PA, Inc
billing.npi Group (Type 2) billing NPI digits 10 digits, valid check digit
billing.address_1 Billing or remit-to street address string often a PO Box
billing.address_2 Billing address suite or unit string often empty
billing.city Billing city string
billing.state Billing state enum 2-letter state
billing.zip Billing ZIP code digits XXXXX
billing.phone Phone number for this location digits XXX-XXX-XXXX

Network

Field Description Type Format / values
network.contract_id The contract in your system this roster belongs to, typed on the Upload step string
network.sender_email Email address of whoever sent the roster, typed on the Upload step string
network.action_type Action the sender is requesting. Detected per row when the file has no action column: TERM if the sheet or file name mentions a termination, otherwise ADD. enum ADD, UPDATE, TERM
network.effective_date Requested effective date of the add, update or termination date YYYY-MM-DD
network.is_primary_location Whether this is the provider's primary service location boolean 0 or 1
network.location_type Role of this location for the provider enum Primary, Secondary, Alternate
network.show_in_dir Whether to show this entry in member-facing provider search boolean 0 or 1
network.provider_type Clinical role; can determine the pay rate enum PCP, SPEC, APP, HOSP, BH
network.is_pcp Whether the provider is a primary care provider (some files use this instead of provider_type) boolean 0 or 1
network.is_bh Whether the provider is a behavioral health provider boolean 0 or 1
network.hospital_based Whether the provider practices only in a hospital setting boolean 0 or 1
network.note Free-text note, most often the termination reason string