Title: Build Tables in the OMOP Common Data Model
Version: 0.1.0
Description: Provides functionality to construct standardised tables from health care data formatted according to the Observational Medical Outcomes Partnership (OMOP) Common Data Model. The package includes tools to build key tables such as observation period and drug era, among others.
License: Apache License (≥ 2)
Encoding: UTF-8
RoxygenNote: 7.3.2
Imports: cli, clock, dplyr, glue, omopgenerics, PatientProfiles, purrr, rlang, tidyr
Depends: R (≥ 4.1)
Suggests: bookdown, CDMConnector, duckdb, ggplot2, gt, knitr, odbc, omock, OmopSketch, rmarkdown, RPostgres, stringr, testthat (≥ 3.0.0), visOmopResults
Config/testthat/edition: 3
URL: https://ohdsi.github.io/OmopConstructor/
BugReports: https://github.com/ohdsi/OmopConstructor/issues
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2025-09-22 19:23:49 UTC; martics
Author: Martí Català ORCID iD [aut, cre], Elin Rowlands ORCID iD [ctb], Cecilia Campanile ORCID iD [ctb]
Maintainer: Martí Català <marti.catalasabate@ndorms.ox.ac.uk>
Repository: CRAN
Date/Publication: 2025-09-30 07:20:28 UTC

OmopConstructor: Build Tables in the OMOP Common Data Model

Description

Provides functionality to construct standardised tables from health care data formatted according to the Observational Medical Outcomes Partnership (OMOP) Common Data Model. The package includes tools to build key tables such as observation period and drug era, among others.

Author(s)

Maintainer: Martí Català marti.catalasabate@ndorms.ox.ac.uk (ORCID)

Other contributors:

See Also

Useful links:


Build observation_period table from data recorded in the cdm_reference

Description

Build observation_period table from data recorded in the cdm_reference

Usage

buildObservationPeriod(
  cdm,
  collapseDays = Inf,
  persistenceDays = Inf,
  dateRange = as.Date(c("1900-01-01", NA)),
  censorAge = 120L,
  recordsFrom = c("drug_exposure", "visit_occurrence"),
  periodTypeConceptId = 32817L
)

Arguments

cdm

A cdm_reference object.

collapseDays

Distance between records to be collapsed.

persistenceDays

Number of days added at the end of an observation period as persistence window.

dateRange

Range of dates to be considered. By default '1900-01-01' is used as start date, whereas for censor date the first available of source_release_date, cdm_release_date, and Sys.Date() will be used.

censorAge

Age to censor individuals if they reach a certain age. The last day in observation of the individual will be the day prior to their birthday.

recordsFrom

Tables to retrieve observation records from.

periodTypeConceptId

Choose the observation_period_type_concept_id that best represents how the period was determined. Accepted Concepts.

Value

The cdm_reference object with a new observation_period.


Collapse records of a cdm_table into episodes.

Description

Collapse records of a cdm_table into episodes.

Usage

collapseRecords(x, startDate, endDate, by, gap = 0L, name = NULL)

Arguments

x

A cdm_table object.

startDate

Column in x that points to the start date of the record.

endDate

Column in x that point to the end date of the record.

by

Columns in x that aggregate the records.

gap

Integer; distance allowed between two consecutive records to be collapsed.

name

Name of the new cdm_table created.

Value

The x cdm_table with the records collapsed.