create_caresite_cohort: Create an OHDSI cohort from a care site.

View source: R/cohort.R

create_caresite_cohortR Documentation

Create an OHDSI cohort from a care site.

Description

For each person who visited the specified care site, their cohort window runs from their first visit start date to their last visit end date at that site. Optionally clips to observation period overlap.

Usage

create_caresite_cohort(
  con,
  care_site_id,
  cohort_id,
  cohort_schema = NULL,
  cdm_schema,
  overwrite = FALSE,
  restrict_to_observation = TRUE,
  collapse_strategy = c("person_span", "visit_occurrence")
)

Arguments

con

DBI connection to the OMOP CDM database.

care_site_id

Integer care_site_id to define the cohort.

cohort_id

Integer cohort_definition_id to assign.

cohort_schema

Schema for the cohort table (NULL = default).

cdm_schema

Schema containing OMOP CDM tables.

overwrite

If TRUE, deletes existing entries for this cohort_id before inserting.

restrict_to_observation

If TRUE (default), clips cohort intervals to observation period overlap.

collapse_strategy

How to collapse visits per person: "person_span" (default) = first visit start to last visit end; "visit_occurrence" = one cohort entry per visit.

Details

This uses server-side INSERT...SELECT for performance on large databases (avoids downloading + re-uploading patient-level data).

Value

Number of rows inserted (invisible).


syrona documentation built on Sept. 5, 2026, 1:06 a.m.