Exercises · Day 3 — Cohorts in ATLAS
Primary tool: Atlas
These exercises use Atlas for cohort building and generation. Open Atlas and confirm you can create a new cohort definition and generate it against a CDM before starting.
No CDM access? Colab fallback
If you don't yet have a CDM connection, a synthetic-data companion notebook is available:
or download it.
What you will do
- Build a new-user riluzole cohort in ATLAS.
- Add an inclusion rule with a temporal window.
- Generate the cohort and read the attrition.
- Export the cohort SQL and re-run a count yourself.
Setup and extraction are site specific
These steps use Databricks as the warehouse and a generic SQL client, because that is what the reference site uses. Your site may use something else (for example Snowflake, Postgres, BigQuery, SQL Server, or Posit Workbench). The cohort logic and the exported SQL are the same everywhere. Only the connection details and the client change. Substitute your local tools wherever Databricks is mentioned.
Step 1: Define the entry event
- In ATLAS, open Cohort Definitions, then New Cohort.
- Add an entry event of drug exposure using a riluzole concept set (build one if needed, with descendants).
- Restrict to the first exposure per person so this is a new-user design.
Step 2: Add an inclusion rule with a window
- Require at least 365 days of continuous observation before the entry event, so that "new use" can be checked against a year of history. ATLAS offers this setting in the entry event section, which is how the written tutorial does it. If you add it as an inclusion rule instead (an observation period criterion), it becomes its own row in the attrition report.
- Add a second rule: a motor neuron disease diagnosis on or before entry (at least one condition occurrence from the Motor neuron disease concept set built on Day 2).
- To practice an exclusion, add no edaravone exposure in the 365 days before entry. This exclusion is written as an inclusion rule that requires exactly zero occurrences.
Step 3: Generate and read attrition
- Define the exit (for example, end of continuous riluzole exposure).
- Save and generate against your training CDM.
- Open the attrition report. Note how many people each inclusion rule removed. A rule that removes almost everyone, or no one, is a prompt to recheck the window and the logic.
Step 4: Export and validate the SQL
- Export the cohort definition SQL from ATLAS (Export tab, SQL, your dialect). The exported SQL has parameters such as the CDM schema, the target cohort table, and the cohort ID that you fill in before running it.
- Run it, or run the simple count below against the cohort table ATLAS generated into, and confirm the person count matches what ATLAS reported.
-- Sanity count of generated cohort (adjust schema/client to your site)
SELECT COUNT(DISTINCT subject_id) AS persons
FROM results.cohort
WHERE cohort_definition_id = :your_cohort_id;
If the counts disagree, check that you generated against the same CDM and vocabulary version you are querying.
Homework
- Rebuild the cohort with a different prior-observation window (for example 180 days) and compare the attrition.
- Write one sentence on how the window changed the cohort size and why.