Database · Import Guide

Load a Versioned NPI Release into Postgres

Create typed staging tables, load the CSV, verify the manifest, and promote rows into an application schema.

Official Postgres import documentation

Before You Start

  • A reviewed NPI Data Hub release
  • Its manifest and checksum
  • A Postgres database

Step-by-Step

  1. 1

    Verify the artifact

    Confirm the checksum and row count against the release manifest.

  2. 2

    Create a staging table

    Use text for NPI and taxonomy codes; use typed dates for source timestamps.

  3. 3

    Load with COPY

    Import the UTF-8 CSV into staging without transforming values in transit.

  4. 4

    Run quality checks

    Check uniqueness, required fields, row counts, and allowed state values.

  5. 5

    Promote atomically

    Replace or version the application table in a transaction.

Field Mapping Reference

Our CSV ColumnPostgres FieldNote
npinpiKeep as text to preserve all ten digits
provider_nameprovider_name
primary_taxonomyprimary_taxonomy
practice_statepractice_state
source_updated_atsource_updated_atParse as a date

Tips for Better Results

Keep the source release ID on every imported batch.
Do not silently coerce invalid NPI values.
Retain the manifest alongside database migration records.

Need the data contract first? Review the synthetic schema preview and published release methodology before importing a future delivered artifact.

Get the Agent List

Frequently Asked Questions

Should NPI be stored as a number?

No. Store NPI as a ten-character string so formatting and leading-zero behavior are explicit.

How do I verify the imported file?

Compare the file checksum and imported row count with the versioned release manifest before using the data.

Other Import Guides