|
| 1 | +# Quickstart 🎉 |
| 2 | + |
| 3 | +Welcome to the Quickstart guide for OMOPCDMFeasibility.jl! This guide shows you how to set up your Julia environment and use OMOPCDMFeasibility.jl for pre- and post-cohort analysis-after you have created a cohort using the recommended observational window template workflow. |
| 4 | + |
| 5 | +## 1. Getting Started |
| 6 | + |
| 7 | +### Launch Julia and Enter Your Project Environment |
| 8 | + |
| 9 | +To get started: |
| 10 | + |
| 11 | +1. **Open your terminal or Julia REPL.** |
| 12 | +2. **Navigate to your project folder (where `Project.toml` is located):** |
| 13 | + |
| 14 | +```sh |
| 15 | +cd path/to/your/project |
| 16 | +``` |
| 17 | + |
| 18 | +3. **Activate the project:** |
| 19 | + |
| 20 | +```sh |
| 21 | +julia --project=. |
| 22 | +``` |
| 23 | + |
| 24 | +4. **(Optional for docs) For working on documentation:** |
| 25 | + |
| 26 | +```sh |
| 27 | +julia --project=docs |
| 28 | +``` |
| 29 | + |
| 30 | +## 2. Create Your Cohort with the Observation Window Template |
| 31 | + |
| 32 | +> For a robust, reproducible template for observational study setup and cohort creation, follow the official workflow : |
| 33 | +> |
| 34 | +> **[Observational Template Workflow](https://juliahealth.org/HealthBase.jl/dev/observational_template_workflow/#2.-Download-OHDSI-Cohort-Definitions)** |
| 35 | +> |
| 36 | +> **1.** Go through steps 2–5 in the workflow to define and create your cohort table in your database. |
| 37 | +> |
| 38 | +> **2.** Once your cohort is created, return here to analyze it with OMOPCDMFeasibility.jl. |
| 39 | +
|
| 40 | +## 3. Pre-Cohort Analysis |
| 41 | + |
| 42 | +Explore your data before defining a cohort. |
| 43 | + |
| 44 | +**Pre-Cohort Analysis:** |
| 45 | + |
| 46 | +- Pre-cohort functions (like `analyze_concept_distribution`) do **not** accept a cohort table or DataFrame. They always analyze the full database, but you can optionally stratify by covariates (e.g., gender, race, age group) using the `covariate_funcs` argument. |
| 47 | +- The `covariate_funcs` argument is optional-include it if you want to stratify by covariates. |
| 48 | + |
| 49 | +To use covariate getter functions, import them from [OMOPCDMCohortCreator.jl](https://github.com/JuliaHealth/OMOPCDMCohortCreator.jl/blob/dev/src/getters.jl): |
| 50 | + |
| 51 | +```julia |
| 52 | +using OMOPCDMCohortCreator: GetPatientGender, GetPatientRace, GetPatientAgeGroup |
| 53 | +``` |
| 54 | + |
| 55 | +For more advanced understanding and options, see [Pre-Cohort Analysis](precohort.md). |
| 56 | + |
| 57 | +```julia |
| 58 | +# Check how common specific OMOP concepts are in your database |
| 59 | +# 201826 = "Hypertension", 3004249 = "Metformin" |
| 60 | +analyze_concept_distribution(conn; concept_set=[201826, 3004249], schema="main") |
| 61 | + |
| 62 | +# Example with covariate_funcs (optional) |
| 63 | +analyze_concept_distribution( |
| 64 | + conn; |
| 65 | + concept_set=[201826, 3004249], |
| 66 | + covariate_funcs=[GetPatientGender, GetPatientRace], |
| 67 | + schema="main" |
| 68 | +) |
| 69 | + |
| 70 | +# Get summary statistics for a set of concepts |
| 71 | +generate_summary(conn; concept_set=[201826, 3004249], schema="main") |
| 72 | + |
| 73 | +# See which OMOP domains your concepts belong to |
| 74 | +generate_domain_breakdown(conn; concept_set=[201826, 3004249], schema="main") |
| 75 | +``` |
| 76 | + |
| 77 | +## 4. Post-Cohort Analysis |
| 78 | + |
| 79 | +After extracting your cohort, you can perform post-cohort analyses as shown below. |
| 80 | + |
| 81 | +**Post-Cohort Analysis:** |
| 82 | + |
| 83 | +- Post-cohort functions (like `create_individual_profiles`) require you to provide either: |
| 84 | + - `cohort_definition_id` (to use a cohort table in the database), or |
| 85 | + - `cohort_df` (a DataFrame of person IDs). |
| 86 | +- You should provide only one of them. |
| 87 | +- The `covariate_funcs` argument is optional-include it if you want to stratify by covariates (e.g., gender, race, age group). |
| 88 | + |
| 89 | +To use covariate getter functions, import them from [OMOPCDMCohortCreator.jl](https://github.com/JuliaHealth/OMOPCDMCohortCreator.jl/blob/dev/src/getters.jl): |
| 90 | + |
| 91 | +```julia |
| 92 | +using OMOPCDMCohortCreator: GetPatientGender, GetPatientRace, GetPatientAgeGroup |
| 93 | +``` |
| 94 | + |
| 95 | +For more advanced understanding and options, see [Post-Cohort Analysis](postcohort.md). |
| 96 | + |
| 97 | +```julia |
| 98 | +# Example: Using a DataFrame |
| 99 | +create_individual_profiles( |
| 100 | + cohort_df = sample_cohort, |
| 101 | + conn = conn, |
| 102 | + # covariate_funcs = [GetPatientGender, GetPatientRace], # optional |
| 103 | + schema = "main" |
| 104 | +) |
| 105 | + |
| 106 | +# Example: Using a cohort_definition_id |
| 107 | +create_individual_profiles( |
| 108 | + cohort_definition_id = 1, |
| 109 | + conn = conn, |
| 110 | + # covariate_funcs = [GetPatientGender, GetPatientRace], # optional |
| 111 | + schema = "main" |
| 112 | +) |
| 113 | +``` |
| 114 | + |
| 115 | +Happy experimenting with OMOPCDMFeasibility.jl! 🎉 |
0 commit comments