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 = 'https://npiregistry.cms.hhs.gov/api/'
       local body = net.http.get{url=url,parameters=params,live=true}
       local res = json.parse{data=body}
       trace(res)
       -- there could be multiple results depending on the search criteria
       for i=1,#res.results do
          local npi = res.results[i].number
          trace(npi)
          -- do something with the NPI number
       end
    

    You can play with the form at https://npiregistry.cms.hhs.gov/api/demo. 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
          trace(last,first)
       end
    

    Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊ http://www.hicgrp.com

    Thank you!

You must be logged in to reply to this topic.