Skip to content

Commit 0e52d50

Browse files
author
User
committed
Initial release of omophub R package v1.0.0
0 parents  commit 0e52d50

79 files changed

Lines changed: 6199 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.Rbuildignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
^\.github$
2+
^LICENSE\.md$
3+
^_pkgdown\.yml$
4+
^docs$
5+
^pkgdown$
6+
^codecov\.yml$
7+
^\.lintr$
8+
^R-requirements\.md$
9+
^.*\.Rproj$
10+
^\.Rproj\.user$
11+
^\.env$
12+
^cran-comments\.md$

.github/workflows/R-CMD-check.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches: [main, master, develop]
4+
pull_request:
5+
branches: [main, master, develop]
6+
7+
name: R-CMD-check
8+
9+
jobs:
10+
R-CMD-check:
11+
runs-on: ${{ matrix.config.os }}
12+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
config:
18+
- {os: macos-latest, r: 'release'}
19+
- {os: windows-latest, r: 'release'}
20+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
21+
- {os: ubuntu-latest, r: 'release'}
22+
- {os: ubuntu-latest, r: 'oldrel-1'}
23+
24+
env:
25+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
26+
R_KEEP_PKG_SOURCE: yes
27+
OMOPHUB_API_KEY: ${{ secrets.OMOPHUB_API_KEY }}
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- uses: r-lib/actions/setup-pandoc@v2
33+
34+
- uses: r-lib/actions/setup-r@v2
35+
with:
36+
r-version: ${{ matrix.config.r }}
37+
http-user-agent: ${{ matrix.config.http-user-agent }}
38+
use-public-rspm: true
39+
40+
- uses: r-lib/actions/setup-r-dependencies@v2
41+
with:
42+
extra-packages: any::rcmdcheck
43+
needs: check
44+
45+
- uses: r-lib/actions/check-r-package@v2
46+
with:
47+
upload-snapshots: true
48+
build_args: 'c("--no-manual", "--compact-vignettes=gs+qpdf")'
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
on:
2+
push:
3+
branches: [main, master, develop]
4+
pull_request:
5+
branches: [main, master, develop]
6+
workflow_dispatch: # Allow manual triggering
7+
8+
name: integration-tests
9+
10+
jobs:
11+
integration:
12+
runs-on: ubuntu-latest
13+
env:
14+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
15+
OMOPHUB_API_KEY: ${{ secrets.OMOPHUB_API_KEY }}
16+
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: r-lib/actions/setup-r@v2
22+
with:
23+
r-version: 'release'
24+
use-public-rspm: true
25+
26+
- uses: r-lib/actions/setup-r-dependencies@v2
27+
with:
28+
extra-packages: any::testthat, any::devtools
29+
needs: check
30+
31+
- name: Run integration tests
32+
run: |
33+
devtools::load_all()
34+
integration_files <- list.files(
35+
"tests/testthat",
36+
pattern = "^test-.*-integration[.]R$",
37+
full.names = TRUE
38+
)
39+
cat("Found", length(integration_files), "integration test files\n")
40+
results <- lapply(integration_files, function(f) {
41+
cat("\n========================================\n")
42+
cat("Running:", basename(f), "\n")
43+
cat("========================================\n\n")
44+
testthat::test_file(f)
45+
})
46+
# Check for failures
47+
failures <- sum(sapply(results, function(r) sum(as.data.frame(r)$failed)))
48+
if (failures > 0) {
49+
stop(paste(failures, "test(s) failed"))
50+
}
51+
shell: Rscript {0}
52+
53+
- name: Upload test results
54+
if: failure()
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: integration-test-failures
58+
path: tests/testthat/

.github/workflows/pkgdown.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
on:
2+
push:
3+
branches: [main, master]
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
name: pkgdown
9+
10+
jobs:
11+
pkgdown:
12+
runs-on: ubuntu-latest
13+
concurrency:
14+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
15+
env:
16+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
17+
18+
permissions:
19+
contents: write
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: r-lib/actions/setup-pandoc@v2
25+
26+
- uses: r-lib/actions/setup-r@v2
27+
with:
28+
use-public-rspm: true
29+
30+
- uses: r-lib/actions/setup-r-dependencies@v2
31+
with:
32+
extra-packages: any::pkgdown, local::.
33+
needs: website
34+
35+
- name: Build site
36+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
37+
shell: Rscript {0}
38+
39+
- name: Deploy to GitHub pages
40+
if: github.event_name != 'pull_request'
41+
uses: JamesIves/github-pages-deploy-action@v4.5.0
42+
with:
43+
clean: false
44+
branch: gh-pages
45+
folder: docs
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
push:
3+
branches: [main, master, develop]
4+
pull_request:
5+
branches: [main, master, develop]
6+
7+
name: test-coverage
8+
9+
jobs:
10+
test-coverage:
11+
runs-on: ubuntu-latest
12+
env:
13+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
14+
OMOPHUB_API_KEY: ${{ secrets.OMOPHUB_API_KEY }}
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: r-lib/actions/setup-r@v2
20+
with:
21+
use-public-rspm: true
22+
23+
- uses: r-lib/actions/setup-r-dependencies@v2
24+
with:
25+
extra-packages: any::covr
26+
needs: coverage
27+
28+
- name: Test coverage
29+
run: |
30+
covr::codecov(
31+
quiet = FALSE,
32+
clean = FALSE,
33+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
34+
)
35+
shell: Rscript {0}
36+
37+
- name: Show testthat output
38+
if: always()
39+
run: |
40+
## --------------------------------------------------------------------
41+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
42+
shell: bash
43+
44+
- name: Upload test results
45+
if: failure()
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: coverage-test-failures
49+
path: ${{ runner.temp }}/package

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# R package specific
2+
*.Rproj.user
3+
.Rproj.user/
4+
.Rhistory
5+
.RData
6+
.Ruserdata
7+
*.Rcheck/
8+
*.tar.gz
9+
10+
# Build artifacts
11+
docs/
12+
NAMESPACE.bak
13+
14+
# Test artifacts
15+
tests/testthat/_snaps/
16+
*.html
17+
*.pdf
18+
19+
# IDE
20+
.idea/
21+
*.swp
22+
*.swo
23+
*~
24+
25+
# OS
26+
.DS_Store
27+
Thumbs.db
28+
29+
# Coverage
30+
covr/
31+
*.gcov
32+
*.gcno
33+
*.gcda
34+
codecov.yml
35+
36+
.env
37+
.env.local
38+
.env.production
39+
cran-comments.md

DESCRIPTION

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Package: omophub
2+
Title: R Client for the OMOPHub Medical Vocabulary API
3+
Version: 1.0.0
4+
Authors@R:
5+
person("OMOPHub", "Team", email = "support@omophub.com",
6+
role = c("aut", "cre", "cph"))
7+
Description: Provides an R interface to the OMOPHub API for accessing
8+
OHDSI ATHENA standardized medical vocabularies. Supports concept search,
9+
vocabulary exploration, hierarchy navigation, relationship queries, and
10+
concept mappings with automatic pagination and rate limiting.
11+
License: MIT + file LICENSE
12+
URL: https://github.com/omopHub/omophub-R,
13+
https://docs.omophub.com
14+
BugReports: https://github.com/omopHub/omophub-R/issues
15+
Depends: R (>= 4.1)
16+
Imports:
17+
httr2 (>= 1.0.0),
18+
R6,
19+
rlang (>= 1.0.0),
20+
cli,
21+
tibble,
22+
purrr,
23+
glue,
24+
checkmate
25+
Suggests:
26+
testthat (>= 3.0.0),
27+
httptest2,
28+
webmockr,
29+
knitr,
30+
rmarkdown,
31+
keyring,
32+
withr
33+
Config/testthat/edition: 3
34+
Encoding: UTF-8
35+
Roxygen: list(markdown = TRUE)
36+
RoxygenNote: 7.3.2
37+
VignetteBuilder: knitr

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
YEAR: 2025
2+
COPYRIGHT HOLDER: OMOPHub

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2025 OMOPHub Team
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NAMESPACE

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
S3method(as.data.frame,omophub_concepts)
4+
S3method(as.data.frame,omophub_hierarchy)
5+
S3method(as.data.frame,omophub_mappings)
6+
S3method(as.data.frame,omophub_relationships)
7+
S3method(as.data.frame,omophub_vocabularies)
8+
S3method(print,omophub_concepts)
9+
S3method(print,omophub_hierarchy)
10+
S3method(print,omophub_mappings)
11+
S3method(print,omophub_relationships)
12+
S3method(print,omophub_vocabularies)
13+
export(OMOPHubClient)
14+
export(get_api_key)
15+
export(has_api_key)
16+
export(set_api_key)
17+
importFrom(R6,R6Class)
18+
importFrom(cli,cli_abort)
19+
importFrom(cli,cli_inform)
20+
importFrom(cli,cli_warn)
21+
importFrom(glue,glue)
22+
importFrom(httr2,req_body_json)
23+
importFrom(httr2,req_error)
24+
importFrom(httr2,req_headers)
25+
importFrom(httr2,req_perform)
26+
importFrom(httr2,req_retry)
27+
importFrom(httr2,req_throttle)
28+
importFrom(httr2,req_timeout)
29+
importFrom(httr2,req_url_path_append)
30+
importFrom(httr2,req_url_query)
31+
importFrom(httr2,req_user_agent)
32+
importFrom(httr2,request)
33+
importFrom(httr2,resp_body_json)
34+
importFrom(httr2,resp_status)
35+
importFrom(purrr,map)
36+
importFrom(purrr,map_chr)
37+
importFrom(purrr,map_dbl)
38+
importFrom(purrr,map_int)
39+
importFrom(purrr,map_lgl)
40+
importFrom(rlang,abort)
41+
importFrom(rlang,caller_env)
42+
importFrom(tibble,as_tibble)
43+
importFrom(tibble,tibble)

0 commit comments

Comments
 (0)