Create a TypeScript module that queries the NPPES NPI Registry API to search and retrieve healthcare provider records.
Function signature:
lookupProvider(query: { name?: string, npi?: string, state?: string }): Promise<Provider[]>
The Provider interface should normalize the raw NPI response into: { id: string, name: string, credential: string, address: string, city: string, state: string, specialty: string, phone: string }.
Requirements:
https://npiregistry.cms.hhs.gov/api/?version=2.1 with the provided query paramsNpiApiError on 5xx or malformed JSONWrite unit tests with 4 fixture cases: found by name, found by NPI, not found, API error. Use vi.mock to avoid real HTTP calls.
No contributions yet.