andrewallenbruce / provider

Public Healthcare Provider APIs :stethoscope:
https://andrewallenbruce.github.io/provider/
Other
18 stars 2 forks source link

Append `ndc_lookup` to `open_payments` #57

Closed andrewallenbruce closed 7 months ago

andrewallenbruce commented 7 months ago

Add option to join NDC info to open_payments

From Medline Plus and RxNorm :

library(provider)
ibrary(tidyverse)

open_payments(year = 2021, 
              npi = 1023630738, 
              na.rm = TRUE) |> 
  mutate(info = ndc_lookup(ndc), 
         ndc = NULL) |> 
  unnest(info) |> 
  glimpse()
#> ✖ No results for NDC = 78206-145-01

#> Rows: 1
#> Columns: 46
#> $ program_year        <int> 2021
#> $ npi                 <chr> "1023630738"
#> $ covered_recipient   <fct> Non-Physician Practitioner
#> $ first               <chr> "ALYSIA"
#> $ middle              <chr> "MOTA"
#> $ last                <chr> "SMITH"
#> $ address             <chr> "610 N HOY ST"
#> $ city                <chr> "BUFFALO"
#> $ state               <ord> OK
#> $ zip                 <chr> "73834"
#> $ country             <chr> "United States"
#> $ primary             <chr> "Physician Assistant"
#> $ specialty           <chr> "Physician Assistants & Advanced Practice Nursing …
#> $ license_state       <ord> OK
#> $ payer_id            <chr> "100000866821"
#> $ payer_sub           <chr> "Organon LLC"
#> $ payer_name          <chr> "Organon LLC"
#> $ payer_state         <ord> NJ
#> $ payer_country       <chr> "United States"
#> $ pay_total           <dbl> 17.43
#> $ pay_date            <date> 2021-08-25
#> $ pay_count           <int> 1
#> $ pay_form            <chr> "In-kind items and services"
#> $ pay_nature          <chr> "Food and Beverage"
#> $ physician_ownership <lgl> FALSE
#> $ third_party_payment <chr> "No Third Party Payment"
#> $ publish_date        <date> 2023-06-30
#> $ publish_delay       <lgl> FALSE
#> $ publish_dispute     <lgl> FALSE
#> $ related_product     <lgl> TRUE
#> $ row_id              <int> 1
#> $ group_id            <int> 1
#> $ name                <chr> "NEXPLANON"
#> $ covered             <lgl> TRUE
#> $ type                <chr> "Drug"
#> $ category            <chr> "CONTRACEPTIVES"
#> $ ndc                 <chr> "78206-145-01"
#> $ rxcui               <chr> "1111011"
#> $ atc                 <chr> "G03AC"
#> $ status              <chr> "ACTIVE"
#> $ brand_name          <chr> "NEXPLANON"
#> $ drug_name           <chr> "etonogestrel 68 MG Drug Implant [Nexplanon]"
#> $ atc_first           <chr> "genito urinary system and sex hormones"
#> $ atc_second          <chr> "sex hormones and modulators of the genital system"
#> $ atc_third           <chr> "hormonal contraceptives for systemic use"
#> $ atc_fourth          <chr> "progestogens"