
Force Study Cohort Index Stays from an External List
Source:R/reconciliation.R
cohort_from_index_stays.RdMaps source patient and encounter identifiers to standard OMOP person_id and
visit_occurrence_id, producing a compliant OMOP cohort table while reporting
match/unmatched diagnostic tallies.
Usage
cohort_from_index_stays(
con,
stays,
id_type = "person_source_value",
person_source_col = "person_source_value",
visit_source_col = "visit_source_value",
index_date_col = "index_date",
end_date_col = "end_date",
cohort_definition_id = 1L,
site_col = "site",
target_table = NULL,
group_by = NULL
)Arguments
- con
Active DuckDB DBI connection.
- stays
Input data frame, CSV/parquet path, or table name.
- id_type
Identifier type ('person_source_value' or 'person_id').
- person_source_col
Patient identifier column in input stays (default 'person_source_value').
- visit_source_col
Optional encounter identifier column (default 'visit_source_value').
- index_date_col
Index/admission date column in input stays (default 'index_date').
- end_date_col
Optional discharge/end date column in input stays (default 'end_date').
- cohort_definition_id
OMOP cohort definition identifier (default 1).
- site_col
Site column name if present (default 'site').
- target_table
Optional table name to persist the cohort in DuckDB.
- group_by
Optional column name (e.g. 'SITE') to stratify match diagnostics by.