From cc204eb4d10acbd1da994b1acaf2a9f580d82741 Mon Sep 17 00:00:00 2001 From: Peter Inglesby Date: Tue, 7 Nov 2023 10:27:46 +0000 Subject: [PATCH] Replace cohortextractor with ehrql Fixes #108 --- analysis/dataset_definition.py | 5 ----- analysis/study_definition.py | 17 ----------------- project.yaml | 14 ++++---------- 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 analysis/study_definition.py diff --git a/analysis/dataset_definition.py b/analysis/dataset_definition.py index 6202e23..8ca2273 100644 --- a/analysis/dataset_definition.py +++ b/analysis/dataset_definition.py @@ -1,8 +1,3 @@ -# Note: If you are using ehrQL to define your study population you need to: -# (1) uncomment the ehrQL action in the project.yaml file (lines 14-18), -# (2) delete the cohort-extractor action from the project.yaml file (lines 8-12), and -# (3) delete the study_definition.py file. - from ehrql import Dataset from ehrql.tables.beta.tpp import patients, practice_registrations diff --git a/analysis/study_definition.py b/analysis/study_definition.py deleted file mode 100644 index c9bb2d9..0000000 --- a/analysis/study_definition.py +++ /dev/null @@ -1,17 +0,0 @@ -# Note: If you are using cohortextrator to define your study population you need to -# (1) delete the ehrQL action in the project.yaml file (lines 14-18) and -# (2) delete the dataset_definition.py file. - -from cohortextractor import StudyDefinition, patients, codelist, codelist_from_csv # NOQA - - -study = StudyDefinition( - default_expectations={ - "date": {"earliest": "1900-01-01", "latest": "today"}, - "rate": "uniform", - "incidence": 0.5, - }, - population=patients.registered_with_one_practice_between( - "2019-02-01", "2020-02-01" - ), -) diff --git a/project.yaml b/project.yaml index a369a7d..84a9f6b 100644 --- a/project.yaml +++ b/project.yaml @@ -1,18 +1,12 @@ version: '3.0' +# Ignore this`expectation` block. It is required but not used, and will be removed in future versions. expectations: population_size: 1000 actions: - - generate_study_population: - run: cohortextractor:latest generate_cohort --output-format csv.gz --study-definition study_definition + generate_dataset: + run: ehrql:v0 generate-dataset analysis/dataset_definition.py --output output/dataset.csv.gz outputs: highly_sensitive: - cohort: output/input.csv.gz - - # generate_dataset: - # run: ehrql:v0 generate-dataset analysis/dataset_definition.py --output output/dataset.csv.gz - # outputs: - # highly_sensitive: - # cohort: output/dataset.csv.gz + dataset: output/dataset.csv.gz