% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fhir.R
\name{FhirResource}
\alias{FhirResource}
\title{FHIR-to-OMOP Concept Resolver}
\value{
A list with \code{input} and \code{resolution} containing source/standard
concepts, target CDM table, and optional enrichments.

When \code{as_tibble = FALSE} (default), a list with \code{results}
(per-item) and \code{summary} (total/resolved/failed). When
\code{as_tibble = TRUE}, a \link[tibble:tibble]{tibble::tibble} suitable for
\code{dplyr}/\code{tidyr} pipelines.

A list with \code{best_match}, \code{alternatives}, and \code{unresolved}.
}
\description{
R6 class providing access to the FHIR-to-OMOP Concept Resolver endpoints.
Translates FHIR coded values (system URI + code) into OMOP standard
concepts, CDM target tables, and optional Phoebe recommendations.
}
\details{
Access via the \code{fhir} active binding on an \code{OMOPHubClient}:

\if{html}{\out{<div class="sourceCode r">}}\preformatted{client <- OMOPHubClient$new(api_key = "oh_xxx")
result <- client$fhir$resolve(
  system = "http://snomed.info/sct",
  code = "44054006",
  resource_type = "Condition"
)
result$data$resolution$target_table
# "condition_occurrence"
}\if{html}{\out{</div>}}
}
\keyword{internal}
\section{Methods}{
\subsection{Public methods}{
\itemize{
\item \href{#method-FhirResource-new}{\code{FhirResource$new()}}
\item \href{#method-FhirResource-resolve}{\code{FhirResource$resolve()}}
\item \href{#method-FhirResource-resolve_batch}{\code{FhirResource$resolve_batch()}}
\item \href{#method-FhirResource-resolve_codeable_concept}{\code{FhirResource$resolve_codeable_concept()}}
\item \href{#method-FhirResource-clone}{\code{FhirResource$clone()}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-FhirResource-new"></a>}}
\if{latex}{\out{\hypertarget{method-FhirResource-new}{}}}
\subsection{Method \code{new()}}{
Create a new FhirResource.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{FhirResource$new(base_req)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{base_req}}{Base httr2 request object.}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-FhirResource-resolve"></a>}}
\if{latex}{\out{\hypertarget{method-FhirResource-resolve}{}}}
\subsection{Method \code{resolve()}}{
Resolve a single FHIR Coding to an OMOP standard concept.

Provide at least one of (\code{system} + \code{code}), (\code{vocabulary_id} + \code{code}),
or \code{display}.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{FhirResource$resolve(
  system = NULL,
  code = NULL,
  display = NULL,
  vocabulary_id = NULL,
  resource_type = NULL,
  include_recommendations = FALSE,
  recommendations_limit = 5L,
  include_quality = FALSE
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{system}}{FHIR code system URI (e.g. \code{"http://snomed.info/sct"}).}

\item{\code{code}}{Code value from the FHIR Coding.}

\item{\code{display}}{Human-readable text (semantic search fallback).}

\item{\code{vocabulary_id}}{Direct OMOP vocabulary_id, bypasses URI resolution.}

\item{\code{resource_type}}{FHIR resource type (e.g. \code{"Condition"}, \code{"Observation"}).}

\item{\code{include_recommendations}}{Logical. Include Phoebe recommendations. Default \code{FALSE}.}

\item{\code{recommendations_limit}}{Integer. Max recommendations (1-20). Default \code{5L}.}

\item{\code{include_quality}}{Logical. Include mapping quality signal. Default \code{FALSE}.}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-FhirResource-resolve_batch"></a>}}
\if{latex}{\out{\hypertarget{method-FhirResource-resolve_batch}{}}}
\subsection{Method \code{resolve_batch()}}{
Batch-resolve up to 100 FHIR Codings.

Failed items are reported inline without failing the batch.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{FhirResource$resolve_batch(
  codings,
  resource_type = NULL,
  include_recommendations = FALSE,
  recommendations_limit = 5L,
  include_quality = FALSE,
  as_tibble = FALSE
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{codings}}{A list of coding lists, each with optional elements
\code{system}, \code{code}, \code{display}, \code{vocabulary_id}.}

\item{\code{resource_type}}{FHIR resource type applied to all codings.}

\item{\code{include_recommendations}}{Logical. Default \code{FALSE}.}

\item{\code{recommendations_limit}}{Integer. Default \code{5L}.}

\item{\code{include_quality}}{Logical. Default \code{FALSE}.}

\item{\code{as_tibble}}{Logical. When \code{TRUE}, returns a \link[tibble:tibble]{tibble::tibble}
with one row per input coding and flat columns for the source
concept, standard concept, target CDM table, mapping type, and
resolution status. The batch \code{summary} (total/resolved/failed)
is attached as \code{attr(result, "summary")}. Default \code{FALSE}
keeps the legacy list-shaped return.}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-FhirResource-resolve_codeable_concept"></a>}}
\if{latex}{\out{\hypertarget{method-FhirResource-resolve_codeable_concept}{}}}
\subsection{Method \code{resolve_codeable_concept()}}{
Resolve a FHIR CodeableConcept with vocabulary preference.

Picks the best match per OHDSI preference order
(SNOMED > RxNorm > LOINC > CVX > ICD-10). Falls back to \code{text}
via semantic search if no coding resolves.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{FhirResource$resolve_codeable_concept(
  coding,
  text = NULL,
  resource_type = NULL,
  include_recommendations = FALSE,
  recommendations_limit = 5L,
  include_quality = FALSE
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{coding}}{A list of coding lists, each with \code{system}, \code{code},
and optional \code{display}.}

\item{\code{text}}{Optional CodeableConcept.text for semantic fallback.}

\item{\code{resource_type}}{FHIR resource type.}

\item{\code{include_recommendations}}{Logical. Default \code{FALSE}.}

\item{\code{recommendations_limit}}{Integer. Default \code{5L}.}

\item{\code{include_quality}}{Logical. Default \code{FALSE}.}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-FhirResource-clone"></a>}}
\if{latex}{\out{\hypertarget{method-FhirResource-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{FhirResource$clone(deep = FALSE)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{deep}}{Whether to make a deep clone.}
}
\if{html}{\out{</div>}}
}
}
}
