{"id":37018335,"url":"https://github.com/OMOPHub/omophub-R","last_synced_at":"2026-01-21T03:01:25.241Z","repository":{"id":305925676,"uuid":"1015223995","full_name":"OMOPHub/omophub-R","owner":"OMOPHub","description":"R SDK for OMOP/OHDSI vocabularies - query 9M+ medical concepts across SNOMED, ICD-10, RxNorm, LOINC \u0026 90+ terminologies via simple API","archived":false,"fork":false,"pushed_at":"2026-01-19T15:48:11.000Z","size":3439,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-20T23:34:31.179Z","etag":null,"topics":["api-client","athena","bioinformatics","cdm","clinical-informatics","clinical-research","cran","healthcare-data","icd10","medical-terminology","medical-vocabularies","ohdsi","ohdsi-vocabulary","omop","r-package","real-world-evidence","rstats","snomed"],"latest_commit_sha":null,"homepage":"https://omophub.github.io/omophub-R/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OMOPHub.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["omophub"]}},"created_at":"2025-07-07T07:28:03.000Z","updated_at":"2026-01-19T15:46:19.000Z","dependencies_parsed_at":"2026-01-07T15:09:08.836Z","dependency_job_id":null,"html_url":"https://github.com/OMOPHub/omophub-R","commit_stats":null,"previous_names":["medilens-io/r-package","omophub/r-package","omophub/omophub-r"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/OMOPHub/omophub-R","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OMOPHub%2Fomophub-R","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OMOPHub%2Fomophub-R/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OMOPHub%2Fomophub-R/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OMOPHub%2Fomophub-R/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OMOPHub","download_url":"https://codeload.github.com/OMOPHub/omophub-R/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OMOPHub%2Fomophub-R/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28624341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T02:47:06.670Z","status":"ssl_error","status_checked_at":"2026-01-21T02:45:44.886Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","athena","bioinformatics","cdm","clinical-informatics","clinical-research","cran","healthcare-data","icd10","medical-terminology","medical-vocabularies","ohdsi","ohdsi-vocabulary","omop","r-package","real-world-evidence","rstats","snomed"],"created_at":"2026-01-14T02:00:32.080Z","updated_at":"2026-01-21T03:01:25.235Z","avatar_url":"https://github.com/OMOPHub.png","language":"R","funding_links":["https://github.com/sponsors/omophub"],"categories":["Vocabulary Tools"],"sub_categories":["Database Connectivity"],"readme":"# OMOPHub R SDK\n\n**Query millions of standardized medical concepts from R**\n\nAccess SNOMED CT, ICD-10, RxNorm, LOINC, and 90+ OHDSI ATHENA vocabularies without downloading, installing, or maintaining local databases.\n\n[![CRAN status](https://www.r-pkg.org/badges/version/omophub)](https://CRAN.R-project.org/package=omophub)\n[![CRAN downloads](https://cranlogs.r-pkg.org/badges/omophub)](https://cran.r-project.org/package=omophub)\n[![R-CMD-check](https://github.com/omopHub/omophub-R/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/omopHub/omophub-R/actions/workflows/R-CMD-check.yaml)\n[![Codecov](https://codecov.io/gh/omopHub/omophub-R/branch/main/graph/badge.svg)](https://app.codecov.io/gh/omopHub/omophub-R?branch=main)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n**[Documentation](https://docs.omophub.com/sdks/r/overview)** ·\n**[API Reference](https://docs.omophub.com/api-reference)** ·\n**[Examples](https://github.com/omopHub/omophub-R/tree/main/inst/examples)**\n\n---\n\n## Why OMOPHub?\nWorking with OHDSI ATHENA vocabularies traditionally requires downloading multi-gigabyte files, setting up a database, and writing complex SQL queries. **OMOPHub eliminates this friction.**\n\n| Traditional Approach | With OMOPHub |\n|---------------------|--------------|\n| Download 5GB+ ATHENA vocabulary files | `install.packages(\"omophub\")` |\n| Set up and maintain database instance | One API call |\n| Write complex SQL with multiple JOINs | Simple R functions |\n| Manually update vocabularies quarterly | Always current data |\n| Local infrastructure required | Works anywhere R runs |\n\n## Installation\n\n```r\n# Install from CRAN\ninstall.packages(\"omophub\")\n\n# Or install development version from GitHub\n# install.packages(\"pak\")\npak::pak(\"omopHub/omophub-R\")\n```\n\n## Authentication\n\n```r\nlibrary(omophub)\n\n# Option 1: Environment variable (recommended)\nSys.setenv(OMOPHUB_API_KEY = \"oh_xxxxxxxxx\")\n\n# Option 2: Use helper function\nset_api_key(\"oh_xxxxxxxxx\")\n\n# Option 3: Store securely in system keyring\nset_api_key(\"oh_xxxxxxxxx\", store = \"keyring\")\n```\n\nGet your API key from the [OMOPHub Dashboard](https://dashboard.omophub.com/api-keys).\n\n## Quick Start\n\n```r\nlibrary(omophub)\n\n# Create client\nclient \u003c- OMOPHubClient$new()\n\n# Get a concept by ID\nconcept \u003c- client$concepts$get(201826)\nconcept$concept_name\n# [1] \"Type 2 diabetes mellitus\"\n\n# Search for concepts\nresults \u003c- client$search$basic(\"metformin\", vocabulary_ids = \"RxNorm\")\nresults$data\n\n# Get concept by vocabulary code\nsnomed_concept \u003c- client$concepts$get_by_code(\"SNOMED\", \"44054006\")\n\n# Map to another vocabulary\nmappings \u003c- client$mappings$get(201826, target_vocabulary = \"ICD10CM\")\n\n# Navigate hierarchy\nancestors \u003c- client$hierarchy$ancestors(201826, max_levels = 3)\n```\n\n## Use Cases\n\n### ETL \u0026 Data Pipelines\n\nValidate and map clinical codes during OMOP CDM transformations:\n\n```r\n# Validate source codes and find standard equivalents\nvalidate_and_map \u003c- function(source_vocab, source_code) {\n  concept \u003c- client$concepts$get_by_code(source_vocab, source_code)\n  \n  if (concept$standard_concept != \"S\") {\n    mappings \u003c- client$mappings$get(\n      concept$concept_id,\n      target_vocabulary = \"SNOMED\"\n    )\n    return(mappings$mappings[[1]]$target_concept_id)\n  }\n  \n  concept$concept_id\n}\n\n# Example: Map ICD-10 to SNOMED\nstandard_id \u003c- validate_and_map(\"ICD10CM\", \"E11.9\")\n```\n\n### Data Quality Checks\n\nVerify codes exist and are valid:\n\n```r\n# Check if condition codes are valid\ncondition_codes \u003c- c(\"E11.9\", \"I10\", \"J44.9\")\n\nfor (code in condition_codes) {\n  tryCatch({\n    concept \u003c- client$concepts$get_by_code(\"ICD10CM\", code)\n    message(sprintf(\"OK %s: %s\", code, concept$concept_name))\n  }, omophub_api_error = function(e) {\n    message(sprintf(\"ERROR %s: Invalid code!\", code))\n  })\n}\n```\n\n### Phenotype Development\n\nExplore hierarchies to build comprehensive concept sets:\n\n```r\n# Get all descendants for phenotype definition\ndescendants \u003c- client$hierarchy$descendants(\n  201826,  # Type 2 diabetes mellitus\n  max_levels = 5\n)\n\nconcept_set \u003c- sapply(descendants$concepts, function(x) x$concept_id)\nmessage(sprintf(\"Found %d concepts for T2DM phenotype\", length(concept_set)))\n```\n\n### Integration with tidyverse\n\n```r\nlibrary(dplyr)\nlibrary(purrr)\n\n# Search and convert to tibble\nresults \u003c- client$search$basic(\"hypertension\", page_size = 100)\n\nconcepts_df \u003c- results$data %\u003e%\n  map_dfr(~ tibble(\n    concept_id = .x$concept_id,\n    concept_name = .x$concept_name,\n    vocabulary_id = .x$vocabulary_id,\n    domain_id = .x$domain_id\n  ))\n\n# Filter and analyze\nconcepts_df %\u003e%\n  filter(vocabulary_id == \"SNOMED\") %\u003e%\n  count(domain_id)\n```\n\n## API Resources\n\n| Resource | Description | Key Methods |\n|----------|-------------|-------------|\n| `concepts` | Concept lookup and batch operations | `get()`, `get_by_code()`, `batch()`, `suggest()` |\n| `search` | Full-text and semantic search | `basic()`, `advanced()`, `basic_all()` |\n| `hierarchy` | Navigate concept relationships | `ancestors()`, `descendants()` |\n| `mappings` | Cross-vocabulary mappings | `get()`, `map()` |\n| `vocabularies` | Vocabulary metadata | `list()`, `get()`, `stats()` |\n| `domains` | Domain information | `list()`, `get()`, `concepts()` |\n\n## Pagination\n\n```r\n# Automatic pagination - fetch all results\nall_results \u003c- client$search$basic_all(\"diabetes\", page_size = 100)\n\n# Manual pagination\npage1 \u003c- client$search$basic(\"diabetes\", page = 1, page_size = 20)\npage2 \u003c- client$search$basic(\"diabetes\", page = 2, page_size = 20)\n```\n\n## Configuration\n\n```r\n# Specify vocabulary version\nclient \u003c- OMOPHubClient$new(vocab_version = \"2025.2\")\n\n# Custom configuration\nclient \u003c- OMOPHubClient$new(\n  api_key = \"oh_xxx\",\n  base_url = \"https://api.omophub.com/v1\",\n  timeout = 30\n)\n```\n\n## Error Handling\n\n```r\ntryCatch({\n  result \u003c- client$concepts$get(999999999)\n}, omophub_not_found_error = function(e) {\n  message(\"Concept not found: \", conditionMessage(e))\n}, omophub_auth_error = function(e) {\n  message(\"Check your API key\")\n}, omophub_rate_limit_error = function(e) {\n  message(\"Rate limited, please wait\")\n}, omophub_api_error = function(e) {\n  message(\"API error: \", conditionMessage(e))\n})\n```\n\n## Compared to Alternatives\n\n| Feature | OMOPHub SDK | ATHENA Download | OHDSI WebAPI |\n|---------|-------------|-----------------|--------------|\n| Setup time | 1 minute | Hours | Hours |\n| Infrastructure | None | PostgreSQL required | Full OHDSI stack |\n| Updates | Automatic | Manual download | Manual |\n| Programmatic access | Native R | SQL/DatabaseConnector | REST API |\n\n**Best for:** R users who need quick, programmatic access to OMOP vocabularies without infrastructure overhead.\n\n## Examples\n\nThe package includes comprehensive examples in `inst/examples/`:\n\n| Example | Description |\n|---------|-------------|\n| `basic_usage.R` | Getting started - client setup, concept lookup, search |\n| `search_concepts.R` | Search capabilities - filters, autocomplete, pagination |\n| `navigate_hierarchy.R` | Hierarchy navigation - ancestors, descendants |\n| `map_between_vocabularies.R` | Cross-vocabulary mapping |\n| `error_handling.R` | Error handling patterns |\n\nRun an example:\n\n```r\nexample_path \u003c- system.file(\"examples\", \"basic_usage.R\", package = \"omophub\")\nsource(example_path)\n```\n\n## Documentation\n\n- [Full Documentation](https://docs.omophub.com/sdks/r/overview)\n- [API Reference](https://docs.omophub.com/api-reference)\n- [Examples](https://github.com/omopHub/omophub-R/tree/main/inst/examples)\n- [Get API Key](https://dashboard.omophub.com/api-keys)\n\n## Contributing\n\nWe welcome contributions! \n\n```r\n# Clone and install for development\n# install.packages(\"devtools\")\ndevtools::install_github(\"omopHub/omophub-R\")\n\n# Run tests\ndevtools::test()\n\n# Check package\ndevtools::check()\n```\n\n## Support\n\n- [GitHub Issues](https://github.com/omopHub/omophub-R/issues)\n- Email: support@omophub.com\n- Website: [omophub.com](https://omophub.com)\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n---\n\n*Built for the OHDSI community*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOMOPHub%2Fomophub-R","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOMOPHub%2Fomophub-R","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOMOPHub%2Fomophub-R/lists"}