Skip to content

Commit

Permalink
Update dataset_definition.py
Browse files Browse the repository at this point in the history
  • Loading branch information
emprestige committed Sep 25, 2024
1 parent 2f3122e commit 9ef7955
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions analysis/dataset_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2201,33 +2201,34 @@ def diff_dates_days(date1, date2):
)

#overall mortality
if study_start_date >= covid_season_min :
if codelist_type == "sensitive" :
if study_start_date >= covid_season_min :

#overall mortality date
dataset.overall_resp_mortality_date = (case(
when(cause_of_death_matches(codelists
.rsv_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.flu_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.covid_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.respiratory_virus_secondary_codelist))
.then(dataset.death_date), otherwise = None)
)

#overall mortality date
dataset.overall_resp_mortality_date = (case(
when(cause_of_death_matches(codelists
.rsv_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.flu_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.covid_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.respiratory_virus_secondary_codelist))
.then(dataset.death_date), otherwise = None)
)

else:

#overall mortality date
dataset.overall_resp_mortality_date = (case(
when(cause_of_death_matches(codelists
.rsv_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.flu_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.respiratory_virus_secondary_codelist))
.then(dataset.death_date), otherwise = None)
)
else:

#overall mortality date
dataset.overall_resp_mortality_date = (case(
when(cause_of_death_matches(codelists
.rsv_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.flu_secondary_codelist)).then(dataset.death_date),
when(cause_of_death_matches(codelists
.respiratory_virus_secondary_codelist))
.then(dataset.death_date), otherwise = None)
)

## comorbidities for secondary investigation

Expand Down

0 comments on commit 9ef7955

Please sign in to comment.