Skip to content

Commit

Permalink
isaric_raw -> isaric
Browse files Browse the repository at this point in the history
  • Loading branch information
iaindillingham committed Nov 8, 2023
1 parent 4ed4802 commit dd87ff8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions analysis/dataset_definition_isaric.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
# Import tables and Python objects
from ehrql import Dataset, days, years, case, when
from ehrql.tables.beta.tpp import (
clinical_events, isaric_raw, patients,
clinical_events, patients,
sgss_covid_all_tests, vaccinations, addresses,
practice_registrations, ons_deaths, hospital_admissions)
from ehrql.tables.beta.raw.tpp import isaric

# Import codelists
import codelists_ehrql
Expand All @@ -39,7 +40,7 @@
dataset = Dataset()

# Define dataset as all patients with an entry in the ISARIC table.
dataset.define_population(isaric_raw.exists_for_patient())
dataset.define_population(isaric.exists_for_patient())



Expand All @@ -50,7 +51,7 @@

# Filter isaric table on first admission for each patient
# Note that sort is on age rather than admission_date as this is more reliable due to some dodgy admission_date values
first_isaric_admission = (isaric_raw.sort_by(isaric_raw.age).first_for_patient())
first_isaric_admission = (isaric.sort_by(isaric.age).first_for_patient())

# Admission date
dataset.first_admission_date_isaric = first_isaric_admission.hostdat
Expand Down Expand Up @@ -278,7 +279,7 @@
# ADD OTHER INFO ------------------------

## Number of admissions
dataset.n_admissions = isaric_raw.count_for_patient()
dataset.n_admissions = isaric.count_for_patient()

## Critical care days for COVID-related hospitalisation
dataset.days_in_critical_care = hospitalisation_diagnosis_matches(
Expand All @@ -293,7 +294,7 @@
dataset.has_died = ons_deaths.where(ons_deaths.date >= dataset.first_admission_date_isaric).exists_for_patient()

## In-hospital death (hospitalisation with discharge + death date on same day or discharge location = death)
#dataset.discharge_date = isaric_raw.first_for_patient().where(dsterm == "Death").dsstdtc
#dataset.discharge_date = isaric.first_for_patient().where(dsterm == "Death").dsstdtc

## Non COVID-19 admission in SUS
dataset.non_covid_admission_SUS_same_date = hospital_admissions.where(
Expand Down

0 comments on commit dd87ff8

Please sign in to comment.