| Title: | R Client for the 'OMOPHub' Medical Vocabulary API |
| Version: | 1.1.0 |
| Description: | Provides an R interface to the 'OMOPHub' API for accessing 'OHDSI ATHENA' standardized medical vocabularies. Supports concept search, vocabulary exploration, hierarchy navigation, relationship queries, and concept mappings with automatic pagination and rate limiting. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/omopHub/omophub-R, https://docs.omophub.com, https://omophub.github.io/omophub-R/ |
| BugReports: | https://github.com/omopHub/omophub-R/issues |
| Depends: | R (≥ 4.1) |
| Imports: | httr2 (≥ 1.0.0), R6, rlang (≥ 1.0.0), cli, tibble, purrr, glue, checkmate |
| Suggests: | testthat (≥ 3.0.0), httptest2, webmockr, knitr, rmarkdown, keyring, withr |
| Config/testthat/edition: | 3 |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2025-12-11 10:11:49 UTC; konstantin |
| Author: | Alex Chen [aut, cre, cph], Observational Health Data Science and Informatics [cph] |
| Maintainer: | Alex Chen <alex@omophub.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-12-17 10:10:15 UTC |
omophub: R Client for the OMOPHub Medical Vocabulary API
Description
Provides an R interface to the OMOPHub API for accessing OHDSI ATHENA standardized medical vocabularies. Supports concept search, vocabulary exploration, hierarchy navigation, relationship queries, and concept mappings with automatic pagination and rate limiting.
Provides an R interface to the OMOPHub API for accessing OHDSI ATHENA standardized medical vocabularies. Supports concept search, vocabulary exploration, hierarchy navigation, relationship queries, and concept mappings with automatic pagination and rate limiting.
Main Client
The main entry point is the OMOPHubClient R6 class which provides access to all API resources:
library(omophub)
client <- OMOPHubClient$new()
# Search for concepts
results <- client$search$basic("diabetes")
# Get a specific concept
concept <- client$concepts$get(201826)
Authentication
Set your API key using one of these methods:
Environment variable:
OMOPHUB_API_KEYExplicit argument:
OMOPHubClient$new(api_key = "your_key")Keyring:
set_api_key("your_key", store = "keyring")
Resources
The client provides access to these resources:
-
concepts: Concept lookup and batch operations -
search: Basic and advanced concept search -
vocabularies: Vocabulary listing and details -
domains: Domain listing and concept filtering -
hierarchy: Ancestor and descendant navigation -
relationships: Concept relationships -
mappings: Concept mappings between vocabularies
Author(s)
Maintainer: OMOPHub Team support@omophub.com [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/omopHub/omophub-R/issues
Package Attach Hook
Description
Package Attach Hook
Usage
.onAttach(libname, pkgname)
Arguments
libname |
Library name. |
pkgname |
Package name. |
Package Load Hook
Description
Package Load Hook
Usage
.onLoad(libname, pkgname)
Arguments
libname |
Library name. |
pkgname |
Package name. |
Concepts Resource
Description
R6 class providing access to concept operations.
Value
A list containing the concept data.
A list containing the concept data with mappings.
A list with concepts and any failures.
A list of suggestions.
Related concepts with scores and analysis.
Relationships with summary.
Methods
Public methods
Method new()
Create a new ConceptsResource.
Usage
ConceptsResource$new(base_req)
Arguments
base_reqBase httr2 request object.
Method get()
Get a concept by ID.
Usage
ConceptsResource$get( concept_id, include_relationships = FALSE, include_synonyms = FALSE )
Arguments
concept_idThe OMOP concept ID.
include_relationshipsInclude related concepts. Default
FALSE.include_synonymsInclude concept synonyms. Default
FALSE.
Method get_by_code()
Get a concept by vocabulary and code.
Usage
ConceptsResource$get_by_code(vocabulary_id, concept_code)
Arguments
vocabulary_idThe vocabulary ID (e.g., "SNOMED", "ICD10CM").
concept_codeThe concept code within the vocabulary.
Method batch()
Get multiple concepts by IDs.
Usage
ConceptsResource$batch( concept_ids, include_relationships = FALSE, include_synonyms = FALSE, include_mappings = FALSE, vocabulary_filter = NULL, standard_only = FALSE )
Arguments
concept_idsVector of concept IDs (max 1000).
include_relationshipsInclude related concepts. Default
FALSE.include_synonymsInclude concept synonyms. Default
FALSE.include_mappingsInclude concept mappings. Default
FALSE.vocabulary_filterFilter results to specific vocabularies.
standard_onlyOnly return standard concepts. Default
FALSE.
Method suggest()
Get concept suggestions (autocomplete).
Usage
ConceptsResource$suggest(query, vocabulary = NULL, domain = NULL, limit = 10)
Arguments
querySearch query (min 2 characters).
vocabularyFilter to specific vocabulary.
domainFilter to specific domain.
limitMaximum suggestions (default 10, max 50).
Method related()
Get related concepts.
Usage
ConceptsResource$related( concept_id, relatedness_types = NULL, vocabulary_ids = NULL, domain_ids = NULL, min_relatedness_score = NULL, max_results = 50, include_scores = TRUE, standard_concepts_only = FALSE )
Arguments
concept_idThe source concept ID.
relatedness_typesTypes of relatedness (hierarchical, semantic, etc.).
vocabulary_idsFilter to specific vocabularies.
domain_idsFilter to specific domains.
min_relatedness_scoreMinimum relatedness score.
max_resultsMaximum results (default 50, max 200).
include_scoresInclude score breakdown. Default
TRUE.standard_concepts_onlyOnly return standard concepts. Default
FALSE.
Method relationships()
Get concept relationships.
Usage
ConceptsResource$relationships( concept_id, relationship_type = NULL, target_vocabulary = NULL, include_invalid = FALSE, page = 1, page_size = 20 )
Arguments
concept_idThe concept ID.
relationship_typeFilter by relationship type.
target_vocabularyFilter by target vocabulary.
include_invalidInclude invalid relationships. Default
FALSE.pagePage number. Default 1.
page_sizeItems per page. Default 20.
Method print()
Print resource information.
Usage
ConceptsResource$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
ConceptsResource$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Domains Resource
Description
R6 class providing access to domain operations.
Value
Domain list with summary.
Paginated concepts.
Methods
Public methods
Method new()
Create a new DomainsResource.
Usage
DomainsResource$new(base_req)
Arguments
base_reqBase httr2 request object.
Method list()
List all domains.
Usage
DomainsResource$list( vocabulary_ids = NULL, include_concept_counts = TRUE, include_statistics = FALSE, include_examples = FALSE, standard_only = FALSE, active_only = TRUE, sort_by = "domain_id", sort_order = "asc" )
Arguments
vocabulary_idsFilter by vocabularies.
include_concept_countsInclude concept counts. Default
TRUE.include_statisticsInclude detailed statistics. Default
FALSE.include_examplesInclude example concepts. Default
FALSE.standard_onlyOnly standard concepts. Default
FALSE.active_onlyOnly active domains. Default
TRUE.sort_bySort field. Default "domain_id".
sort_orderSort order. Default "asc".
Method concepts()
Get concepts in a domain.
Usage
DomainsResource$concepts( domain_id, vocabulary_ids = NULL, concept_class_ids = NULL, standard_only = FALSE, page = 1, page_size = 50 )
Arguments
domain_idThe domain ID.
vocabulary_idsFilter by vocabularies.
concept_class_idsFilter by concept classes.
standard_onlyOnly standard concepts. Default
FALSE.pagePage number. Default 1.
page_sizeResults per page. Default 50.
Method print()
Print resource information.
Usage
DomainsResource$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
DomainsResource$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Hierarchy Resource
Description
R6 class providing access to hierarchy operations (ancestors and descendants).
Value
Ancestors with hierarchy summary.
Descendants with hierarchy summary.
Methods
Public methods
Method new()
Create a new HierarchyResource.
Usage
HierarchyResource$new(base_req)
Arguments
base_reqBase httr2 request object.
Method ancestors()
Get concept ancestors.
Usage
HierarchyResource$ancestors( concept_id, vocabulary_id = NULL, max_levels = NULL, relationship_types = NULL, include_paths = FALSE, include_distance = TRUE, standard_only = FALSE, include_deprecated = FALSE, page = 1, page_size = 100 )
Arguments
concept_idThe concept ID.
vocabulary_idFilter to specific vocabulary.
max_levelsMaximum hierarchy levels to traverse.
relationship_typesRelationship types to follow (default: "Is a").
include_pathsInclude path information. Default
FALSE.include_distanceInclude distance from source. Default
TRUE.standard_onlyOnly return standard concepts. Default
FALSE.include_deprecatedInclude deprecated concepts. Default
FALSE.pagePage number. Default 1.
page_sizeResults per page. Default 100.
Method descendants()
Get concept descendants.
Usage
HierarchyResource$descendants( concept_id, vocabulary_id = NULL, max_levels = 10, relationship_types = NULL, include_distance = TRUE, standard_only = FALSE, include_deprecated = FALSE, domain_ids = NULL, concept_class_ids = NULL, include_synonyms = FALSE, page = 1, page_size = 100 )
Arguments
concept_idThe concept ID.
vocabulary_idFilter to specific vocabulary.
max_levelsMaximum hierarchy levels (default 10, max 10).
relationship_typesRelationship types to follow.
include_distanceInclude distance from source. Default
TRUE.standard_onlyOnly return standard concepts. Default
FALSE.include_deprecatedInclude deprecated concepts. Default
FALSE.domain_idsFilter by domains.
concept_class_idsFilter by concept classes.
include_synonymsInclude synonyms. Default
FALSE.pagePage number. Default 1.
page_sizeResults per page. Default 100.
Method print()
Print resource information.
Usage
HierarchyResource$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
HierarchyResource$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Mappings Resource
Description
R6 class providing access to mapping operations.
Value
Mappings with summary.
Mapping results with summary.
Methods
Public methods
Method new()
Create a new MappingsResource.
Usage
MappingsResource$new(base_req)
Arguments
base_reqBase httr2 request object.
Method get()
Get mappings for a concept.
Usage
MappingsResource$get( concept_id, target_vocabularies = NULL, mapping_types = NULL, direction = "both", include_indirect = FALSE, standard_only = FALSE, include_mapping_quality = FALSE, include_synonyms = FALSE, include_context = FALSE, active_only = TRUE, sort_by = NULL, sort_order = NULL, page = 1, page_size = 50 )
Arguments
concept_idThe concept ID.
target_vocabulariesFilter by target vocabularies.
mapping_typesFilter by mapping types.
directionMapping direction ("outgoing", "incoming", "both"). Default "both".
include_indirectInclude indirect mappings. Default
FALSE.standard_onlyOnly standard concept mappings. Default
FALSE.include_mapping_qualityInclude quality metrics. Default
FALSE.include_synonymsInclude synonyms. Default
FALSE.include_contextInclude mapping context. Default
FALSE.active_onlyOnly active mappings. Default
TRUE.sort_bySort field.
sort_orderSort order.
pagePage number. Default 1.
page_sizeResults per page. Default 50.
Method map()
Map concepts to a target vocabulary.
Usage
MappingsResource$map( source_concepts, target_vocabulary, mapping_type = NULL, include_invalid = FALSE )
Arguments
source_conceptsVector of OMOP concept IDs to map.
target_vocabularyTarget vocabulary ID (e.g., "ICD10CM", "SNOMED").
mapping_typeMapping type (direct, equivalent, broader, narrower).
include_invalidInclude invalid mappings. Default
FALSE.
Method print()
Print resource information.
Usage
MappingsResource$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
MappingsResource$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
OMOPHub API Client
Description
R6 class for interacting with the OMOPHub vocabulary service. Provides access to OHDSI ATHENA standardized medical vocabularies.
Details
The client provides access to these resources:
-
concepts: Concept lookup and batch operations -
search: Basic and advanced concept search -
vocabularies: Vocabulary listing and details -
domains: Domain listing and concept filtering -
hierarchy: Ancestor and descendant navigation -
relationships: Concept relationships -
mappings: Concept mappings between vocabularies
Value
A new OMOPHubClient object.
Active bindings
conceptsAccess to concept operations.
searchAccess to search operations.
vocabulariesAccess to vocabulary operations.
domainsAccess to domain operations.
hierarchyAccess to hierarchy operations.
relationshipsAccess to relationship operations.
mappingsAccess to mapping operations.
Methods
Public methods
Method new()
Create a new OMOPHub client.
Usage
OMOPHubClient$new( api_key = NULL, base_url = NULL, timeout = 30, max_retries = 3, vocab_version = NULL )
Arguments
api_keyAPI key for authentication. If not provided, reads from
OMOPHUB_API_KEYenvironment variable or system keyring.base_urlAPI base URL. Defaults to
https://api.omophub.com/v1.timeoutRequest timeout in seconds. Defaults to 30.
max_retriesMaximum retry attempts for failed requests. Defaults to 3.
vocab_versionOptional vocabulary version (e.g., "2025.1"). If not specified, uses the latest version.
Method print()
Print client information.
Usage
OMOPHubClient$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
OMOPHubClient$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
# Create client (uses OMOPHUB_API_KEY env var)
client <- OMOPHubClient$new()
# Or with explicit API key
client <- OMOPHubClient$new(api_key = "your_api_key")
# Search for concepts
results <- client$search$basic("diabetes")
# Get a specific concept
concept <- client$concepts$get(201826)
# Use specific vocabulary version
client <- OMOPHubClient$new(vocab_version = "2025.1")
## End(Not run)
Relationships Resource
Description
R6 class providing access to relationship operations.
Value
Relationships with summary.
Relationship types with metadata.
Methods
Public methods
Method new()
Create a new RelationshipsResource.
Usage
RelationshipsResource$new(base_req)
Arguments
base_reqBase httr2 request object.
Method get()
Get relationships for a concept.
Usage
RelationshipsResource$get( concept_id, relationship_type = NULL, target_vocabulary = NULL, include_invalid = FALSE, page = 1, page_size = 50 )
Arguments
concept_idThe concept ID.
relationship_typeFilter by relationship type.
target_vocabularyFilter by target vocabulary.
include_invalidInclude invalid relationships. Default
FALSE.pagePage number. Default 1.
page_sizeResults per page. Default 50.
Method types()
Get available relationship types.
Usage
RelationshipsResource$types( vocabulary_ids = NULL, include_reverse = FALSE, include_usage_stats = FALSE, include_examples = FALSE, category = NULL, is_defining = NULL, standard_only = FALSE, page = 1, page_size = 100 )
Arguments
vocabulary_idsFilter by vocabularies.
include_reverseInclude reverse relationships. Default
FALSE.include_usage_statsInclude usage statistics. Default
FALSE.include_examplesInclude example concepts. Default
FALSE.categoryFilter by category.
is_definingFilter by defining status.
standard_onlyOnly standard relationships. Default
FALSE.pagePage number. Default 1.
page_sizeResults per page. Default 100.
Method print()
Print resource information.
Usage
RelationshipsResource$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
RelationshipsResource$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Search Resource
Description
R6 class providing access to search operations.
Value
Search results with pagination.
A tibble of all matching concepts.
Search results with facets and metadata.
Autocomplete suggestions.
Methods
Public methods
Method new()
Create a new SearchResource.
Usage
SearchResource$new(base_req)
Arguments
base_reqBase httr2 request object.
Method basic()
Basic concept search.
Usage
SearchResource$basic( query, vocabulary_ids = NULL, domain_ids = NULL, concept_class_ids = NULL, standard_concept = NULL, include_synonyms = FALSE, include_invalid = FALSE, min_score = NULL, exact_match = FALSE, page = 1, page_size = 20, sort_by = NULL, sort_order = NULL )
Arguments
querySearch query string.
vocabulary_idsFilter by vocabulary IDs.
domain_idsFilter by domain IDs.
concept_class_idsFilter by concept class IDs.
standard_conceptFilter by standard concept ("S", "C", or NULL).
include_synonymsSearch in synonyms. Default
FALSE.include_invalidInclude invalid concepts. Default
FALSE.min_scoreMinimum relevance score.
exact_matchRequire exact match. Default
FALSE.pagePage number (1-based). Default 1.
page_sizeResults per page. Default 20.
sort_bySort field.
sort_orderSort order ("asc" or "desc").
Method basic_all()
Fetch all search results with automatic pagination.
Usage
SearchResource$basic_all( query, vocabulary_ids = NULL, domain_ids = NULL, page_size = 100, max_pages = Inf, progress = TRUE, ... )
Arguments
querySearch query string.
vocabulary_idsFilter by vocabulary IDs.
domain_idsFilter by domain IDs.
page_sizeResults per page. Default 100.
max_pagesMaximum pages to fetch. Default Inf.
progressShow progress bar. Default
TRUE....Additional search parameters.
Method advanced()
Advanced concept search with facets.
Usage
SearchResource$advanced( query, vocabularies = NULL, domains = NULL, concept_classes = NULL, standard_concepts_only = FALSE, include_invalid = FALSE, relationship_filters = NULL, limit = 20, offset = 0 )
Arguments
querySearch query string.
vocabulariesFilter by vocabularies.
domainsFilter by domains.
concept_classesFilter by concept classes.
standard_concepts_onlyOnly return standard concepts. Default
FALSE.include_invalidInclude invalid concepts. Default
FALSE.relationship_filtersRelationship-based filters.
limitMaximum results. Default 20.
offsetResult offset. Default 0.
Method autocomplete()
Get autocomplete suggestions.
Usage
SearchResource$autocomplete( query, vocabulary_ids = NULL, domains = NULL, max_suggestions = 10 )
Arguments
queryPartial query string.
vocabulary_idsFilter by vocabulary IDs.
domainsFilter by domains.
max_suggestionsMaximum suggestions. Default 10.
Method print()
Print resource information.
Usage
SearchResource$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
SearchResource$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Vocabularies Resource
Description
R6 class providing access to vocabulary operations.
Value
Paginated vocabulary list.
Vocabulary details.
Vocabulary statistics.
Domain statistics for vocabularies.
Paginated concepts.
Methods
Public methods
Method new()
Create a new VocabulariesResource.
Usage
VocabulariesResource$new(base_req)
Arguments
base_reqBase httr2 request object.
Method list()
List all vocabularies.
Usage
VocabulariesResource$list( include_stats = FALSE, include_inactive = FALSE, sort_by = "name", sort_order = "asc", page = 1, page_size = 100 )
Arguments
include_statsInclude vocabulary statistics. Default
FALSE.include_inactiveInclude inactive vocabularies. Default
FALSE.sort_bySort field ("name", "priority", "updated"). Default "name".
sort_orderSort order ("asc" or "desc"). Default "asc".
pagePage number. Default 1.
page_sizeResults per page. Default 100.
Method get()
Get vocabulary details.
Usage
VocabulariesResource$get( vocabulary_id, include_stats = FALSE, include_domains = FALSE )
Arguments
vocabulary_idThe vocabulary ID.
include_statsInclude statistics. Default
FALSE.include_domainsInclude domain breakdown. Default
FALSE.
Method stats()
Get vocabulary statistics.
Usage
VocabulariesResource$stats(vocabulary_id)
Arguments
vocabulary_idThe vocabulary ID.
Method domains()
Get vocabulary domains.
Usage
VocabulariesResource$domains(vocabulary_ids = NULL, page = 1, page_size = 50)
Arguments
vocabulary_idsFilter by vocabulary IDs (optional).
pagePage number. Default 1.
page_sizeResults per page. Default 50.
Method concepts()
Get concepts in a vocabulary.
Usage
VocabulariesResource$concepts( vocabulary_id, domain_id = NULL, concept_class_id = NULL, standard_only = FALSE, page = 1, page_size = 50 )
Arguments
vocabulary_idThe vocabulary ID.
domain_idFilter by domain.
concept_class_idFilter by concept class.
standard_onlyOnly standard concepts. Default
FALSE.pagePage number. Default 1.
page_sizeResults per page. Default 50.
Method print()
Print resource information.
Usage
VocabulariesResource$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
VocabulariesResource$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Abort with OMOPHub API Error
Description
Abort with OMOPHub API Error
Usage
abort_api_error(status, message, endpoint, call = rlang::caller_env())
Arguments
status |
HTTP status code. |
message |
Error message. |
endpoint |
API endpoint that failed. |
call |
The calling environment. |
Abort with Authentication Error
Description
Abort with Authentication Error
Usage
abort_auth_error(message, call = rlang::caller_env())
Arguments
message |
Error message. |
call |
The calling environment. |
Abort with Rate Limit Error
Description
Abort with Rate Limit Error
Usage
abort_rate_limit(retry_after = NULL, call = rlang::caller_env())
Arguments
retry_after |
Seconds until rate limit resets. |
call |
The calling environment. |
Abort with Validation Error
Description
Abort with Validation Error
Usage
abort_validation(message, arg = NULL, call = rlang::caller_env())
Arguments
message |
Error message. |
arg |
The argument that failed validation. |
call |
The calling environment. |
Convert Boolean to API String
Description
Convert Boolean to API String
Usage
bool_to_str(x)
Arguments
x |
A logical value. |
Value
"true" or "false" string, or NULL if x is NULL.
Build Base OMOPHub Request
Description
Creates an httr2 request object with authentication, rate limiting, and retry logic configured.
Usage
build_request(
base_url,
api_key,
timeout = 30,
max_retries = 3,
vocab_version = NULL
)
Arguments
base_url |
API base URL. |
api_key |
API key for authentication. |
timeout |
Request timeout in seconds. |
max_retries |
Maximum retry attempts. |
vocab_version |
Optional vocabulary version. |
Value
An httr2 request object.
Extract Error Message from API Response
Description
Extract Error Message from API Response
Usage
extract_error_message(resp)
Arguments
resp |
An httr2 response object. |
Value
A character string with the error message.
Extract Pagination Metadata
Description
Extracts pagination metadata from an API response.
Usage
extract_pagination(response)
Arguments
response |
API response object. |
Value
A list with pagination fields.
Get OMOPHub API Key
Description
Retrieves the OMOPHub API key from multiple sources in priority order:
Explicit argument
-
OMOPHUB_API_KEYenvironment variable System keyring (if
keyringpackage is installed)
Usage
get_api_key(key = NULL)
Arguments
key |
Optional explicit API key. If provided, this takes precedence. |
Value
A character string containing the API key.
Examples
## Not run:
# From environment variable
Sys.setenv(OMOPHUB_API_KEY = "your_api_key")
key <- get_api_key()
# Explicit key
key <- get_api_key("your_api_key")
## End(Not run)
Check if API Key is Available
Description
Checks whether an OMOPHub API key is available without throwing an error.
Usage
has_api_key()
Value
TRUE if an API key is available, FALSE otherwise.
Check if Error is Transient (Retryable)
Description
Check if Error is Transient (Retryable)
Usage
is_transient_error(resp)
Arguments
resp |
An httr2 response object. |
Value
TRUE if the error is transient and should be retried.
Join List Elements for Query Parameter
Description
Join List Elements for Query Parameter
Usage
join_params(x, sep = ",")
Arguments
x |
A character vector. |
sep |
Separator (default comma). |
Value
A single comma-separated string, or NULL if x is NULL/empty.
Create OMOPHub Concepts Result
Description
Creates an S3 object for concept search results.
Usage
new_omophub_concepts(data, meta = list())
Arguments
data |
Concept data (list or tibble). |
meta |
Pagination metadata. |
Value
An omophub_concepts S3 object.
Create OMOPHub Hierarchy Result
Description
Create OMOPHub Hierarchy Result
Usage
new_omophub_hierarchy(data, meta = list(), type = "hierarchy")
Arguments
data |
Hierarchy data (ancestors or descendants). |
meta |
Metadata including summary. |
type |
Type of hierarchy ("ancestors" or "descendants"). |
Value
An omophub_hierarchy S3 object.
Create OMOPHub Mappings Result
Description
Create OMOPHub Mappings Result
Usage
new_omophub_mappings(data, meta = list())
Arguments
data |
Mapping data. |
meta |
Metadata. |
Value
An omophub_mappings S3 object.
Create OMOPHub Relationships Result
Description
Create OMOPHub Relationships Result
Usage
new_omophub_relationships(data, meta = list())
Arguments
data |
Relationship data. |
meta |
Metadata. |
Value
An omophub_relationships S3 object.
Create OMOPHub Vocabularies Result
Description
Create OMOPHub Vocabularies Result
Usage
new_omophub_vocabularies(data, meta = list())
Arguments
data |
Vocabulary data. |
meta |
Pagination metadata. |
Value
An omophub_vocabularies S3 object.
Fetch All Paginated Results
Description
Fetches all pages of results and combines them into a single tibble.
Usage
paginate_all(fetch_fn, page_size = 100, max_pages = Inf, progress = TRUE)
Arguments
fetch_fn |
A function that takes |
page_size |
Number of items per page. Default 100. |
max_pages |
Maximum number of pages to fetch. Default |
progress |
Show progress bar. Default |
Value
A tibble containing all fetched results.
Create Lazy Pagination Iterator
Description
Creates an iterator that fetches pages on demand.
Usage
paginate_lazy(fetch_fn, page_size = 100)
Arguments
fetch_fn |
A function that takes |
page_size |
Number of items per page. Default 100. |
Value
An iterator object with next_page() and has_more() methods.
Perform GET Request
Description
Perform GET Request
Usage
perform_get(base_req, endpoint, query = NULL)
Arguments
base_req |
Base request object. |
endpoint |
API endpoint path. |
query |
Named list of query parameters. |
Value
Parsed JSON response. For paginated endpoints, returns a list with
data (the results) and meta (pagination info). For single-item endpoints,
returns the unwrapped data directly.
Perform POST Request
Description
Perform POST Request
Usage
perform_post(base_req, endpoint, body = NULL, query = NULL)
Arguments
base_req |
Base request object. |
endpoint |
API endpoint path. |
body |
Named list for JSON body. |
query |
Named list of query parameters. |
Value
Parsed JSON response (unwrapped from data field if present).
Set OMOPHub API Key
Description
Stores the OMOPHub API key in the specified location.
Usage
set_api_key(key, store = c("env", "keyring"))
Arguments
key |
The API key to store. |
store |
Where to store the key. One of:
|
Value
Invisibly returns TRUE on success.
Examples
## Not run:
# Store in environment (current session only)
set_api_key("your_api_key")
# Store securely in keyring (persistent)
set_api_key("your_api_key", store = "keyring")
## End(Not run)
Validate Concept ID
Description
Validate Concept ID
Usage
validate_concept_id(concept_id, arg = "concept_id", call = rlang::caller_env())
Arguments
concept_id |
A concept ID to validate. |
arg |
Argument name for error messages. |
call |
The calling environment. |
Validate Page Parameters
Description
Validate Page Parameters
Usage
validate_pagination(
page,
page_size,
max_page_size = 1000,
call = rlang::caller_env()
)
Arguments
page |
Page number. |
page_size |
Page size. |
max_page_size |
Maximum allowed page size. |
call |
The calling environment. |