Coding a more intuitive framework for an EDI Payer List from external sources for internal use.
Electronic Data Interchange (EDI) is a technology that allows the exchange of commercial information between organizations in a structured digital form based on regulated message formats and standards. Any standard business document exchanged between companies can be transferred using the EDI standard.
These are all different standards to exchange electronic business documents. Some of these standards have been developed for use in a specific industry, according to its special needs. Other standards are developed and widely used, based on geography. For example, the EDI ANSI X12 standard is developed by the American National Standards Institute (ANSI). HIPAA (the Health Insurance Portability and Accountability Act of 1996) is designed specifically to comply with healthcare law. HL7 (Health Level 7) is the standard to exchange medical information.
The Payer ID or EDI is a unique ID assigned to each insurance company. It allows provider and payer systems to talk to one another to verify eligibility, benefits and submit claims. The payer ID is generally five (5) characters but it may be longer. It may also be alpha, numeric or a combination. The payer ID is often located on the back of the insurance card in the Provider or Claims Submission section. Below are some common examples. If you are unable to locate the payer ID, please enter NA or None.
Data downloaded from url: https://payers.gatewayedi.com/payerlist/default.aspx
payer_preview <- head(hcfa_payers, 10)
paged_table(payer_preview)
With column names like Available \n Transactions, we
need to rename them to follow a tidy format:
hcfa_payers <- hcfa_payers |>
rename(
payername = "Payer Name",
id = "PayerId",
avail_trans = "Available \n Transactions",
enroll_req = "Enrollment \n Required",
format = "Payer \n Format",
icd_vers = "Payer ICD Version",
transition_date = "Payer ICD \n Transition Date"
)
payer_preview <- head(hcfa_payers, 10)
paged_table(payer_preview)
We can remove three columns, for the following reasons:
format: V5010 and
V4010 refer to the electronic claim format standard
developed by ANSI. Since all HIPAA-covered entities migrated to V5010 by
January 1, 2012, this information no longer applies.
icd_vers: indicates the version of the
International Classification of Diseases, Clinical
Modification that the payer uses. Since all payers now use the
Tenth Revision, this information is no longer valid.
transition_date: refers to the date that the payer
transitioned from ICD-9-CM to ICD-10-CM, which is again no longer
applicable.
hcfa_payers <- hcfa_payers |>
select(payername, id, avail_trans, enroll_req)
payer_preview <- head(hcfa_payers, 10)
paged_table(payer_preview)
payername ColumnThe payername column has the payer’s name and the states
that the payer operates in. To make this information searchable in our
data frame, we’ll need to do some data wrangling.
payername
into two columnsWe’ll start by splitting it into two columns, payer and
service_states, using the str_detect() and
str_match() functions from the {stringr} package:
hcfa_payers <- hcfa_payers |>
mutate(
payer = ifelse(
str_detect(
payername,
"\\sServicing States"
),
str_match(
payername,
"(.*)\\sServicing States"
)[, 2],
payername
),
service_states = str_match(
payername,
"Servicing States:\\s(.*)"
)[, 2]
) |>
select(
payer,
service_states,
id,
avail_trans,
enroll_req
)
payer_preview <- head(hcfa_payers, 10)
paged_table(payer_preview)
service_states with “ALL”Payers designated as servicing all states were given an “NA” in the
new service_states column because there was no space
between the colon and “ALL” (i.e., “States:ALL”) and the regex
expression that I used indicated that there would be a space between the
payer name and the state. We fix this by simply replacing all NAs with
“ALL”:
hcfa_payers <- hcfa_payers |>
mutate(service_states = ifelse(is.na(service_states), "ALL", service_states))
payer_preview <- head(hcfa_payers, 10)
paged_table(payer_preview)
avail_trans and enroll_req into individual
columnsThese two columns are a little bit trickier. We want each available
transaction to correspond to whether or not enrollment is required to
use them. I’ll use str_match() to split them one-by-one
into a wide format, merge each pair together with {tidyr}’s
unite() function, pivot to a longer format, and then
perform some general cleanup to finish up.
Here, I’m splitting each transaction available to it’s own column as well it’s corresponding enrollment required indicator. This may look like overkill (and I’m almost certain that it absolutely is) but I want to make sure I get every transaction. I can remove any duplicates later on.
hcfa_payers <- hcfa_payers |>
separate_rows(avail_trans, enroll_req, sep = " \n ")
payer_preview <- head(hcfa_payers, 10)
paged_table(payer_preview)
hcfa_payers <- hcfa_payers |>
distinct()
payer_preview <- head(hcfa_payers, 10)
paged_table(payer_preview)
avail_trans
Variableshcfa_payers <- hcfa_payers |>
mutate(avail_trans = case_when(
avail_trans == "ProfessionalClaims" ~ "Professional Claims",
avail_trans == "Rtpa" ~ "RTPA",
avail_trans == "ClaimAttachments" ~ "Claim Attachments",
avail_trans == "ElectronicRemits" ~ "Electronic Remits",
avail_trans == "Remits" ~ "Remits",
avail_trans == "InsuranceEligibilityDiscovery" ~ "Insurance Eligibility Discovery",
avail_trans == "ClaimStatus" ~ "Claim Status",
avail_trans == "ElectronicCob" ~ "Electronic COB",
avail_trans == "Eligibility" ~ "Eligibility",
avail_trans == "InstitutionalClaims" ~ "Institutional Claims",
avail_trans == "AuthorizationAndReferrals" ~ "Authorization & Referrals",
avail_trans == "DentalClaims" ~ "Dental Claims",
TRUE ~ "Unknown"
))
payer_preview <- head(hcfa_payers, 10)
paged_table(payer_preview)
hcfa_payers <- hcfa_payers |>
mutate(
trans_colors = case_when(
avail_trans == "Professional Claims" ~ "#FFACAC",
avail_trans == "RTPA" ~ "#A45746",
avail_trans == "Claim Attachments" ~ "#132F3C",
avail_trans == "Electronic Remits" ~ "#140E0F",
avail_trans == "Remits" ~ "#74AAEB",
avail_trans == "Insurance Eligibility Discovery" ~ "#1D4C62",
avail_trans == "Claim Status" ~ "#95A494",
avail_trans == "Electronic COB" ~ "#DBB592",
avail_trans == "Eligibility" ~ "#F6CCB0",
avail_trans == "Institutional Claims" ~ "#EBA42B",
avail_trans == "Authorization & Referrals" ~ "#E85569",
avail_trans == "Dental Claims" ~ "#5C2C2D",
TRUE ~ "Unknown"
),
enroll_colors = case_when(
enroll_req == "NO" ~ "#f0fff0",
enroll_req == "Yes" ~ "#C7662A",
TRUE ~ "Unknown"
)
)
payer_preview <- head(hcfa_payers, 10)
paged_table(payer_preview)
reactable(hcfa_payers,
filterable = TRUE,
striped = FALSE,
highlight = TRUE,
showPageSizeOptions = TRUE,
class = "packages-table",
onClick = "expand",
rowStyle = list(cursor = "pointer"),
paginationType = "simple",
groupBy = "payer",
defaultSorted = "payer",
defaultColDef = colDef(
headerClass = "col-header",
footerClass = "col-footer"
),
columns = list(
payer = colDef(
name = "Payer"
),
service_states = colDef(
name = "States",
width = 100,
aggregate = "unique"
),
id = colDef(
name = "Payer ID",
class = "number",
width = 100,
aggregate = "unique"
),
avail_trans = colDef(
name = "Available Transactions",
aggregate = "unique",
cell = pill_buttons(
data = hcfa_payers,
color_ref = "trans_colors",
box_shadow = FALSE
)
),
enroll_req = colDef(
name = "Enrollment Required",
width = 200,
aggregate = "frequency",
cell = pill_buttons(
data = hcfa_payers,
color_ref = "enroll_colors",
box_shadow = FALSE
)
),
trans_colors = colDef(show = FALSE),
enroll_colors = colDef(show = FALSE)
)
) |>
add_title(
title = "Insurance Payer Information",
margin = reactablefmtr::margin(t = 10, r = 0, b = 15, l = 0)
) |>
add_subtitle(
subtitle = "For Electronic Data Interchange (EDI): Treatment, Payment, Operations (TPO)",
margin = reactablefmtr::margin(t = 10, r = 0, b = 15, l = 0)
) |>
add_source(
font_color = "#C8C8C8",
align = "right",
margin = reactablefmtr::margin(t = 0, r = 10, b = 0, l = 0),
source = html("Table: <a href='https://twitter.com/aabrucehimni'>@aabrucehimni</a> | Data: <a href='https://payers.gatewayedi.com/payerlist/default.aspx'>Trizetto Gateway EDI</a> & <a href='http://www.healthdataservices.com/payerid/payerlist.htm'>Health Data Services, Inc.</a>")
)
Table: @aabrucehimni | Data: Trizetto Gateway EDI & Health Data Services, Inc.