You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
admissions.deathtime is considered as the reference (compared to patients table)
for 11 admissions, the admissions.deathtime is after the admissions.dischtime.
However, for those 11 patients the patients.dod_hosp is equal to the admissions.dischtime. Then the later is used in this particular case
patients dead during hospitalisation have death_type_concept_id equal to 38003569
only dod_ssn is taken in consideration and the omop death_type_concept_id is equal to 261
Examples
Number of dead patients in the dataset
SELECTCOUNT(person_id) AS num_deaths_count
FROM death;
num_deaths_count
14849
distinct death_type_concept_id dead patients in the database
SELECT distinct concept_name, death_type_concept_id as concept_id
FROM death d
JOIN concept c ONd.death_type_concept_id=c.concept_id;
concept_name
concept_id
EHR record patient status "Deceased"
38003569
US Social Security Death Master File record
261
Distribution of age of death
SELECT FLOOR (percentile_25) AS percentile_25
, FLOOR(median) AS median
, FLOOR(percentile_75) AS percentile_75
, FLOOR (MIN( cast(death.death_datetimeasdate) - cast(person.birth_datetimeasdate) ) /365.242 ) AS minimum
, FLOOR (MAX( cast(death.death_datetimeasdate) - cast(person.birth_datetimeasdate) ) /365.242 ) AS maximum
, CAST(FLOOR (AVG(cast(death.death_datetimeasdate) - cast(person.birth_datetimeasdate)) /365.242 ) ASINTEGER) AS mean
, FLOOR(STDDEV( cast(death.death_datetimeasdate) - cast(person.birth_datetimeasdate) ) /365.242 ) AS stddev
FROM
(SELECTMAX( CASE WHEN( percentile =1 ) THEN age_deaths END ) AS percentile_25
, MAX( CASE WHEN( percentile =2 ) THEN age_deaths END ) AS median
, MAX( CASE WHEN( percentile =3 ) THEN age_deaths END ) AS percentile_75
FROM
( SELECTcounter.age_deaths, counter.deaths
, FLOOR( CAST( SUM( age_deaths ) OVER( ORDER BY age_deaths ROWS UNBOUNDED PRECEDING ) ASDECIMAL )
/ CAST( SUM( age_deaths ) OVER( ORDER BY age_deaths ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING ) ASDECIMAL )
*4
) +1as percentile
FROM
( SELECT FLOOR (cast(death.death_datetimeasdate) - cast(person.birth_datetimeasdate)) /365.242as age_deaths, count(*) AS deaths
FROM death as death
INNER JOIN person as person USING (person_id)
GROUP BY FLOOR (cast(death.death_datetimeasdate) - cast(person.birth_datetimeasdate))
) as counter
) as p
WHERE percentile <=3
) as percentile_table, death
INNER JOIN person as person USING (person_id)
GROUP BY percentile_25, median, percentile_75;