
Recode transfer discharges in a database built before the ETL mapped 'IP' to 8717
Source:R/cohort.R
remap_discharge_status.RdSets discharged_to_concept_id to concept_id for visits whose discharged_to_source_value is IP
(case-insensitive, whitespace ignored) and whose concept id is NULL or 0. Idempotent; needs write access
except with dry_run = TRUE. With as_view = TRUE nothing is written: a TEMP view view_name (default
visit_occurrence_recoded) carries the recoded concept id, for read-only production databases; view_name = "visit_occurrence" makes it shadow the table for unqualified queries on this connection.
Usage
remap_discharge_status(
con,
schema = NULL,
concept_id = 8717L,
dry_run = FALSE,
as_view = FALSE,
view_name = "visit_occurrence_recoded"
)Arguments
- con
DuckDB connection.
- schema
Optional schema holding
visit_occurrence.- concept_id
Concept id to write (default 8717, 'Inpatient Hospital').
- dry_run
If
TRUE, only count the visits that would be recoded (works on a read-only connection).- as_view
If
TRUE, create a TEMP view instead of updating the table.- view_name
Name of that view.