This topic contains 2 replies, has 2 voices, and was last updated by  josh.horwitz 7 years, 7 months ago.

NPI Lookup?

  • Hey guys,

    Has anyone found a way too intergrate NPI lookup in the translator?

    There’s a public API for the NPI registry, and it’s pretty easy to use. The sample below is using data from a physician in my home town, and it’s all publicly accessible information.

    From a translator, you can grab a physician’s NPI with only a few identifiers and a couple of lines of code:

       local params = {first_name = 'roy',
          last_name = 'nakamura',
               city = 'brunswick',
              state = 'me'}
       local url = ''
       local body = net.http.get{url=url,parameters=params,live=true}
       local res = json.parse{data=body}
       -- there could be multiple results depending on the search criteria
       for i=1,#res.results do
          local npi = res.results[i].number
          -- do something with the NPI number

    You can play with the form at It will build a link that you can decompose into the url (preceding the question mark) and parameter section (following the question mark) of the request.

    If you’re looking up by number to get other identifying data, the parameter value is even simpler:

    local params = {number = '1265487516'}

    And you can grab whatever information you need from the JSON payload returned:

       for i=1,#res.results do
          local basic = res.results[i].basic
          local last  = basic.last_name
          local first = basic.first_name

    Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊

    Thank you!

You must be logged in to reply to this topic.