Mirrors python/omop_etl/build_omop_cdm.py table-for-table. Both read the
same PCORnet-format source directory, share the same schema and concept-resolution
logic, and generate 100% deterministic surrogate keys and OHDSI v5.4 tables.
Usage
etl_pcornet(
source_dir,
db_path = "omop_cdm.duckdb",
central_vocab = NULL,
site_id = NULL,
site_anon = NULL,
site_name = NULL,
disambiguate_patids = FALSE,
auto_resources = FALSE,
memory_limit = NULL,
threads = NULL,
temp_dir = NULL
)Arguments
- source_dir
Directory containing PCORnet-format CSVs (
demographic.csv,encounter.csv,diagnosis.csv,procedures.csv,lab_result_cm.csv,prescribing.csv,provider.csv, optionallyvital.csv,facility.csv, and optionallydeath.csv), matched case-insensitively. Any table whose source file isn't found is skipped.- db_path
Path to the DuckDB database file (schema + vocabulary must already exist).
- central_vocab
Optional path to an existing central vocabulary DuckDB database to attach in read-only mode with zero-copy views.
- site_id
Optional numeric site identifier (e.g. 1 to 5).
- site_anon
Optional publication pseudonym (e.g. "Site A").
- site_name
Optional institutional name or internal descriptor (e.g. "Hospital System A").
- disambiguate_patids
Logical. If
TRUE, formatsperson_source_valueassrc.PATID || '-' || site_idand derives surrogate keys viapcornet_id(src.PATID || '-' || site_id).- auto_resources
Logical. If
TRUE, size DuckDB to the host withconfigure_resources()(75% of available RAM, best spill volume, cores - 1) before loading;memory_limit,threadsandtemp_dirstill win over the detected values.- memory_limit
Optional DuckDB
memory_limit, e.g."16GB".- threads
Optional DuckDB worker thread count.
- temp_dir
Optional DuckDB disk-spill directory.
