
Check that a DuckDB file is ready for OHDSI HADES (PatientLevelPrediction / DeepPatientLevelPrediction)
Source:R/hades_bridge.R
hades_preflight.RdPatientLevelPrediction, DeepPatientLevelPrediction and FeatureExtraction read the CDM through
DatabaseConnector, which opens the DuckDB file on its own and cannot ATTACH anything on connect.
So everything HADES queries has to live inside the file. This runs the checks against a fresh
connection to the file with nothing attached, i.e. exactly what DatabaseConnector will see, which is
why a vocabulary that is only reachable through an attached central_vocab catalog is reported as a
failure here even though it works in your own session.
Usage
hades_preflight(
db_path,
cdm_database_schema = "main",
cohort_database_schema = cdm_database_schema,
cohort_table = "cohort"
)Value
A data.frame with columns check, ok, detail and class hades_preflight; the attribute
all_ok is TRUE when every check passed.
Details
Checks: required CDM tables exist, person / observation_period are populated, the vocabulary
(concept) is readable from inside the file, and the cohort table has the OHDSI cohort columns and
rows.
DatabaseConnector opens the file read-write, which cannot coexist with another process holding it,
even read-only (for example a Python session that still has the database open). Connections within
this R session never conflict. A check therefore opens the file read-write, as DatabaseConnector does,
and reports who is in the way instead of letting getPlpData() fail later with an IO error.