Skip to contents

Loads the Patient, Encounter, Observation, Condition and MedicationRequest / MedicationAdministration / MedicationStatement resources of a FHIR R4 Bundle into a throw-away temporary DuckDB CDM (deleted on exit) and runs score_encounter(). Observations are matched on LOINC and creatinine / BUN are converted from SI units. Condition and medication codes are loaded only when concept_map (c("system|code" = concept_id)) maps them or, when vocab_con / vocab_db_path is given, resolve_fhir_codes() finds them in the OMOP vocabulary; the rest are returned in fhir$unmapped_codes. Mirror of Python omop_etl.fhir.score_fhir_bundle.

Usage

score_fhir_bundle(
  fhir_json,
  model_bundle,
  encounter_id = NULL,
  as_of = NULL,
  concept_map = NULL,
  explain = FALSE,
  top_k = 5L,
  vocab_con = NULL,
  vocab_db_path = NULL,
  ...
)

Arguments

fhir_json

A FHIR Bundle as a JSON string, a file path, or a parsed list.

model_bundle

A model_bundle or bundle directory.

encounter_id

Encounter id to score (default: the latest by start).

as_of, concept_map, explain, top_k

See score_encounter().

vocab_con

A DBI connection with the OMOP vocabulary, used for codes not in concept_map.

vocab_db_path

Path of a DuckDB vocabulary file (opened read-only) used when vocab_con is NULL.

...

Further arguments to score_encounter().

Value

As score_encounter() plus a fhir element.