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
it maps mimic location discharge type to omop location discharge type
Example
explanation of visit_type_concept_id
SELECT distinct concept_name, visit_type_concept_id as concept_id
FROM visit_detail v
JOIN concept c ONv.visit_type_concept_id=c.concept_id;
concept_name
concept_id
Services and care
45770670
Ward and physical location
2000000006
explanation of visit_detail_concept_id, distribution of type of care
SELECT concept_name, concept_id, count(1)
FROM visit_detail
JOIN concept ON visit_detail_concept_id = concept_id
WHERE visit_type_concept_id =45770670-- concept.concept_name = 'Services and care'GROUP BY1, 2ORDER BYcount(1) desc;
concept_name
concept_id
count
General medical service
45763735
88209
Surgical service
4149152
73729
Newborn care service
4237225
16718
Psychiatry service
4150859
1
explanation of visit_detail_concept_id, distribution of ward types (physical location)
SELECT concept_name, concept_id, count(1)
FROM visit_detail
JOIN concept ON visit_detail_concept_id = concept_id
WHERE visit_type_concept_id =2000000006-- concept.concept_name = 'Ward and physical location'GROUP BY1, 2ORDER BYcount(1) desc;
concept_name
concept_id
count
No matching concept
0
87766
Intensive Care
32037
71570
Emergency Room Visit
9203
30877
Inpatient Visit
9201
8237
explanation of care_site_id, transfers table in non omop mimic
-- transfers table (mimic)SELECT place_of_service_source_value, count (1)
FROM visit_detail JOIN care_site c USING (care_site_id)
WHERE visit_type_concept_id =2000000006-- concept.concept_name = 'Ward and physical location'GROUP BY1ORDER BYcount(1) DESC;
place_of_service_source_value
count
Unknown Ward
87766
Emergency Room Critical Care Facility
30877
Medical intensive care unit
24289
Cardiac surgery recovery unit
11818
Surgical intensive care unit
10688
Coronary care unit
9005
Neonatal intensive care unit
8472
Neonatal ward
8237
Trauma/surgical intensive care unit
7298
explanation of care_site_id, service table in non omop table
SELECT place_of_service_source_value, count (1)
FROM visit_detail JOIN care_site c USING (care_site_id)
WHERE visit_type_concept_id =45770670-- concept.concept_name = 'Services and care'GROUP BY1ORDER BYcount(1) DESC;
place_of_service_source_value
count
Medical - general service for internal medicine
57032
Cardiac Surgery - for surgical cardiac admissions
23775
Cardiac Medical - for non-surgical cardiac related admissions
20663
Surgical - general surgical service not classified elsewhere
16600
Newborn - infants born at the hospital
16258
Neurologic Surgical - surgical, relating to the brain
10574
Trauma - injury or damage caused by physical harm from an external source
7034
Neurologic Medical - non-surgical, relating to the brain
6395
Vascular Surgical - surgery relating to the circulatory system
5422
Orthopaedic medicine - non-surgical, relating to musculoskeletal system
4119
Thoracic Surgical - surgery on the thorax, located between the neck and the abdomen
3974
Orthopaedic - surgical, relating to the musculoskeletal system
2911
Genitourinary - reproductive organs/urinary system
1144
Plastic - restortation/reconstruction of the human body (including cosmetic or aesthetic)
775
Gynecological - female reproductive systems and breasts
674
Ear, nose, and throat - conditions primarily affecting these areas
614
Newborn baby - infants born at the hospital
460
Obstetrics - conerned with childbirth and the care of women giving birth
218
Dental - for dental/jaw related admissions
14
Psychiatric - mental disorders relating to mood, behaviour, cognition, or perceptions
1
Number of patients in ICU
SELECTCOUNT(distinct visit_detail_id) AS num_totalstays_count
FROM visit_detail
WHERE visit_detail_concept_id =32037-- concept.concept_name = 'Intensive Care'AND visit_type_concept_id =2000000006; -- concept.concept_name = 'Ward and physical location'
num_totalstays_count
71570
Number of dead patients in ICU
SELECTcount(distinct visit_detail_id) AS dead_hospital_count
FROM visit_detail
JOIN concept ON visit_detail_concept_id = concept_id
WHERE visit_detail_concept_id =32037-- concept.concept_name = 'Intensive Care'AND visit_type_concept_id =2000000006-- concept.concept_name = 'Ward and physical location'AND discharge_to_concept_id =4216643; -- concept.concept_name = 'Patient died'
dead_hospital_count
4559
% of dead patients in ICU
WITH tmp AS
(
SELECTCOUNT(distinct d.visit_detail_id) AS dead
, COUNT(distinct t.visit_detail_id) AS total
FROM visit_detail t
LEFT JOIN
(
SELECT visit_detail_id
FROM visit_detail
WHERE visit_detail_concept_id =32037-- concept.concept_name = 'Intensive Care'AND visit_type_concept_id =2000000006-- concept.concept_name = 'Ward and physical location'AND discharge_to_concept_id =4216643-- concept.concept_name = 'Patient died'
) d USING (visit_detail_id)
WHEREt.visit_detail_concept_id=32037ANDt.visit_type_concept_id=2000000006
)
SELECT dead, total, dead *100/ total as percentage FROM tmp;
dead
total
percentage
4559
71570
6
Distribution of length of stay in ICU
SELECT percentile_25
, median
, percentile_75
, MIN( EXTRACT(EPOCH FROM visit_end_datetime - visit_start_datetime)/60.0/60.0/24.0 ) AS minimum
, MAX( EXTRACT(EPOCH FROM visit_end_datetime - visit_start_datetime)/60.0/60.0/24.0 ) AS maximum
, CAST(AVG( EXTRACT(EPOCH FROM visit_end_datetime - visit_start_datetime)/60.0/60.0/24.0 ) ASINTEGER) AS mean
, STDDEV( EXTRACT(EPOCH FROM visit_end_datetime - visit_start_datetime)/60.0/60.0/24.0 ) AS stddev
FROM
(SELECTMAX( CASE WHEN( percentile =1 ) THEN los END ) AS percentile_25
, MAX( CASE WHEN( percentile =2 ) THEN los END ) AS median
, MAX( CASE WHEN( percentile =3 ) THEN los END ) AS percentile_75
FROM
( SELECTcounter.los, counter.nb_los
, FLOOR( CAST( SUM( nb_los ) OVER( ORDER BY los ROWS UNBOUNDED PRECEDING ) ASDECIMAL )
/ CAST( SUM( nb_los ) OVER( ORDER BY los ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING ) ASDECIMAL )
*4
) +1as percentile
FROM
( SELECT EXTRACT(EPOCH FROM visit_end_datetime - visit_start_datetime)/60.0/60.0/24.0as los, count(*) AS nb_los
FROM visit_detail
WHERE visit_detail_concept_id =32037-- concept.concept_name = 'Intensive Care'AND visit_type_concept_id =2000000006-- concept.concept_name = 'Ward and physical location' GROUP BY EXTRACT(EPOCH FROM visit_end_datetime - visit_start_datetime)/60.0/60.0/24.0
) as counter
) as p
WHERE percentile <=3
) as percentile_table, visit_detail
WHERE visit_detail_concept_id =32037-- concept.concept_name = 'Intensive Care'AND visit_type_concept_id =2000000006-- concept.concept_name = 'Ward and physical location' GROUP BY percentile_25, median, percentile_75;