-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: CCN validator #59
Labels
Milestone
Comments
Using {ivs}:Code
short <- dplyr::tibble(
type = "Short-term (General and Specialty) Hospital",
start = 1L,
end = 880L
)
ord <- dplyr::tibble(
type = "Hospital participating in ORD demonstration project",
start = 880L,
end = 900L
)
fqhc <- dplyr::tibble(
type = c("Federally Qualified Health Center", "Federally Qualified Health Center"),
start = c(1000L, 1800L),
end = c(1200L, 1990L),
)
maf <- dplyr::tibble(
type = "Medical Assistance Facility",
start = 1225L,
end = 1300L
)
cah <- dplyr::tibble(
type = "Critical Access Hospital",
start = 1300L,
end = 1400L
)
cmhc <- dplyr::tibble(
type = c("Community Mental Health Center",
"Community Mental Health Center",
"Community Mental Health Center"),
start = c(1400L, 4600L, 4900L),
end = c(1500L, 4800L, 5000L)
)
hospice <- dplyr::tibble(
type = "Hospice",
start = 1500L,
end = 1800L
)
rnmhci <- dplyr::tibble(
type = "Religious Non-medical Health Care Institution (formerly Christian Science Sanatoria Hospital Services)",
start = 1990L,
end = 2000L
)
ltch <- dplyr::tibble(
type = "Long-Term Care Hospital",
start = 2000L,
end = 2300L
)
hbrdf <- dplyr::tibble(
type = "Hospital-based Renal Dialysis Facility",
start = 2300L,
end = 2500L
)
irdf <- dplyr::tibble(
type = "Independent Renal Dialysis Facility",
start = 2500L,
end = 2900L
)
isprdf <- dplyr::tibble(
type = "Independent Special Purpose Renal Dialysis Facility",
start = 2900L,
end = 3000L
)
rehosp <- dplyr::tibble(
type = "Rehabilitation Hospital",
start = 3025L,
end = 3100L
)
hha <- dplyr::tibble(
type = c("Home Health Agency",
"Home Health Agency",
"Home Health Agency"),
start = c(3100L, 7000L, 9000L),
end = c(3200L, 8500L, 9800L)
)
child <- dplyr::tibble(
type = "Children's Hospital",
start = 3300L,
end = 3400L
)
rhcp <- dplyr::tibble(
type = c("Rural Health Clinic (Provider-based)",
"Rural Health Clinic (Provider-based)",
"Rural Health Clinic (Provider-based)"),
start = c(3400L, 3975L, 8500L),
end = c(3500L, 4000L, 8900L)
)
rhcf <- dplyr::tibble(
type = c("Rural Health Clinic (Free-standing)",
"Rural Health Clinic (Free-standing)"),
start = c(3800L, 8900L),
end = c(3975L, 9000L)
)
hbsrdf <- dplyr::tibble(
type = "Hospital-based Satellite Renal Dialysis Facility",
start = 3500L,
end = 3700L
)
hbsprdf <- dplyr::tibble(
type = "Hospital-based Special Purpose Renal Dialysis Facility",
start = 3700L,
end = 3800L
)
psych <- dplyr::tibble(
type = "Psychiatric Hospital",
start = 4000L,
end = 4500L
)
corf <- dplyr::tibble(
type = c("Comprehensive Outpatient Rehabilitation Facility",
"Comprehensive Outpatient Rehabilitation Facility",
"Comprehensive Outpatient Rehabilitation Facility"),
start = c(3200L, 4500L, 4800L),
end = c(3300L, 4600L, 4900L)
)
snf <- dplyr::tibble(
type = "Skilled Nursing Facility",
start = 5000L,
end = 6500L
)
outpts <- dplyr::tibble(
type = "Outpatient Physical Therapy Services",
start = 6500L,
end = 6990L
)
tplant <- dplyr::tibble(
type = "Transplant Center",
start = 9800L,
end = 9900L
)
numrsrv <- dplyr::tibble(
type = "Number Reserved (formerly Christian Science Sanatoria Skilled Nursing Services)",
start = 6990L,
end = 7000L
)
futrsrv <- dplyr::tibble(
type = "Reserved for Future Use",
start = 9900L,
end = 10000L
)
mhcmc <- dplyr::tibble(
type = "Multiple Hospital Component in a Medical Complex (Number Retired)",
start = 900L,
end = 1000L
)
adhret <- dplyr::tibble(
type = "Alcohol/Drug Hospital (Number Retired)",
start = 1200L,
end = 1225L
)
tubret <- dplyr::tibble(
type = "Tuberculosis Hospital (Number Retired)",
start = 3000L,
end = 3025L
)
ranges <- dplyr::bind_rows(adhret, cah, child, cmhc, corf, fqhc,
futrsrv, hbrdf, hha, hospice, hbsprdf,
hbsrdf, irdf, isprdf, ltch, maf, mhcmc,
numrsrv, ord, outpts, psych, rehosp, rhcf,
rhcp, rnmhci, short, snf, tplant, tubret) range_test <- ranges |>
dplyr::arrange(start) |>
dplyr::mutate(range = ivs::iv(start, end), .keep = "unused")
range_test
#> # A tibble: 39 × 2
#> type range
#> <chr> <iv<int>>
#> 1 Short-term (General and Specialty) Hospital [1, 880)
#> 2 Hospital participating in ORD demonstration project [880, 900)
#> 3 Multiple Hospital Component in a Medical Complex (Number Retir… [900, 1000)
#> 4 Federally Qualified Health Center [1000, 1200)
#> 5 Alcohol/Drug Hospital (Number Retired) [1200, 1225)
#> 6 Medical Assistance Facility [1225, 1300)
#> 7 Critical Access Hospital [1300, 1400)
#> 8 Community Mental Health Center [1400, 1500)
#> 9 Hospice [1500, 1800)
#> 10 Federally Qualified Health Center [1800, 1990)
#> 11 Religious Non-medical Health Care Institution (formerly Christ… [1990, 2000)
#> 12 Long-Term Care Hospital [2000, 2300)
#> 13 Hospital-based Renal Dialysis Facility [2300, 2500)
#> 14 Independent Renal Dialysis Facility [2500, 2900)
#> 15 Independent Special Purpose Renal Dialysis Facility [2900, 3000)
#> 16 Tuberculosis Hospital (Number Retired) [3000, 3025)
#> 17 Rehabilitation Hospital [3025, 3100)
#> 18 Home Health Agency [3100, 3200)
#> 19 Comprehensive Outpatient Rehabilitation Facility [3200, 3300)
#> 20 Children's Hospital [3300, 3400)
#> 21 Rural Health Clinic (Provider-based) [3400, 3500)
#> 22 Hospital-based Satellite Renal Dialysis Facility [3500, 3700)
#> 23 Hospital-based Special Purpose Renal Dialysis Facility [3700, 3800)
#> 24 Rural Health Clinic (Free-standing) [3800, 3975)
#> 25 Rural Health Clinic (Provider-based) [3975, 4000)
#> 26 Psychiatric Hospital [4000, 4500)
#> 27 Comprehensive Outpatient Rehabilitation Facility [4500, 4600)
#> 28 Community Mental Health Center [4600, 4800)
#> 29 Comprehensive Outpatient Rehabilitation Facility [4800, 4900)
#> 30 Community Mental Health Center [4900, 5000)
#> 31 Skilled Nursing Facility [5000, 6500)
#> 32 Outpatient Physical Therapy Services [6500, 6990)
#> 33 Number Reserved (formerly Christian Science Sanatoria Skilled … [6990, 7000)
#> 34 Home Health Agency [7000, 8500)
#> 35 Rural Health Clinic (Provider-based) [8500, 8900)
#> 36 Rural Health Clinic (Free-standing) [8900, 9000)
#> 37 Home Health Agency [9000, 9800)
#> 38 Transplant Center [9800, 9900)
#> 39 Reserved for Future Use [9900, 10000)
facility_code <- 3000L
range_test |>
dplyr::mutate(is_between = ivs::iv_includes(range, facility_code)) |>
dplyr::filter(is_between == TRUE) |>
dplyr::pull(type)
#> [1] "Tuberculosis Hospital (Number Retired)" Created on 2023-11-29 with reprex v2.0.2 |
andrewallenbruce
added a commit
that referenced
this issue
Nov 29, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code
Created on 2023-11-29 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: