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 documentationBefore You Start
- A reviewed NPI Data Hub release
- Its manifest and checksum
- A Postgres database
Step-by-Step
- 1
Verify the artifact
Confirm the checksum and row count against the release manifest.
- 2
Create a staging table
Use text for NPI and taxonomy codes; use typed dates for source timestamps.
- 3
Load with COPY
Import the UTF-8 CSV into staging without transforming values in transit.
- 4
Run quality checks
Check uniqueness, required fields, row counts, and allowed state values.
- 5
Promote atomically
Replace or version the application table in a transaction.
Field Mapping Reference
| Our CSV Column | Postgres Field | Note |
|---|---|---|
| npi | npi | Keep as text to preserve all ten digits |
| provider_name | provider_name | — |
| primary_taxonomy | primary_taxonomy | — |
| practice_state | practice_state | — |
| source_updated_at | source_updated_at | Parse as a date |
Tips for Better Results
Need the data contract first? Review the synthetic schema preview and published release methodology before importing a future delivered artifact.
Get the Agent ListFrequently 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.