From 98e30a408a3739dc6277f3db60ee9b52af3ff1eb Mon Sep 17 00:00:00 2001 From: Alistair Johnson Date: Thu, 15 Sep 2016 15:44:08 -0400 Subject: [PATCH] removed version and author from individual files, better to track in github --- Makefile | 3 --- buildmimic/apache-drill/drill_create_data.sql | 2 -- buildmimic/docker/Dockerfile | 2 -- buildmimic/monetdb/monetdb_create_tables.sql | 2 -- buildmimic/monetdb/monetdb_load_data.sql | 2 -- comorbidity/postgres/Makefile | 4 ---- comorbidity/postgres/clean.sql | 6 ++--- demographics/postgres/Makefile | 4 ---- demographics/postgres/clean.sql | 7 ++---- etc/Makefile | 3 --- etc/clean.sql | 6 ++--- etc/firstday/Makefile | 7 ++---- etc/firstday/blood-gas-first-day.sql | 2 -- etc/firstday/clean.sql | 6 ++--- etc/firstday/urine-output-first-day.sql | 3 --- etc/firstday/ventilation-first-day.sql | 4 +--- sepsis/Makefile | 4 ---- sepsis/angus.sql | 23 ++++++++----------- sepsis/clean.sql | 6 ++--- severityscores/Makefile | 3 --- severityscores/apsiii.sql | 11 ++++----- severityscores/clean.sql | 6 ++--- severityscores/lods.sql | 14 ++++------- severityscores/mlods.sql | 9 ++++---- severityscores/oasis.sql | 12 ++++------ severityscores/qsofa.sql | 14 +++++------ severityscores/saps.sql | 14 +++++------ severityscores/sapsii.sql | 12 ++++------ severityscores/sirs.sql | 12 ++++------ severityscores/sofa.sql | 12 ++++------ styleguide.md | 18 ++++++--------- 31 files changed, 78 insertions(+), 155 deletions(-) diff --git a/Makefile b/Makefile index 6727e8b24..0e7027b76 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,6 @@ ## ------------------------------------------------------------------ ## Title: Top-level build file ## Description: Automated import of data and SQL scripts -## MIMIC version: MIMIC-III v1.4 -## Author: Jim Blundell 2016 ## ------------------------------------------------------------------ ## Parameters ## @@ -107,4 +105,3 @@ clean: @$(MAKE) -e -C severityscores clean .PHONY: help mimic mimic-build mimic-download mimic-check mimic-gz mimic-build-gz mimic-check-gz extra etc comorbidity demographics sepsis severityscores - diff --git a/buildmimic/apache-drill/drill_create_data.sql b/buildmimic/apache-drill/drill_create_data.sql index a767c7c04..9afa3c072 100644 --- a/buildmimic/apache-drill/drill_create_data.sql +++ b/buildmimic/apache-drill/drill_create_data.sql @@ -1,8 +1,6 @@ -- ------------------------------------------------------------------ -- Title: Create the MIMIC-III tables -- Description: More detailed description explaining the purpose. --- MIMIC version: MIMIC-III v1.3 --- Created by: paris nicolas -- ------------------------------------------------------------------ diff --git a/buildmimic/docker/Dockerfile b/buildmimic/docker/Dockerfile index b96e2c9f7..1a61883fb 100644 --- a/buildmimic/docker/Dockerfile +++ b/buildmimic/docker/Dockerfile @@ -1,7 +1,5 @@ FROM postgres:latest -MAINTAINER Aaron J. Masino - # in the docker initialization, we do not build the data ENV BUILD_MIMIC 0 diff --git a/buildmimic/monetdb/monetdb_create_tables.sql b/buildmimic/monetdb/monetdb_create_tables.sql index 293d3884c..41d8a30ec 100644 --- a/buildmimic/monetdb/monetdb_create_tables.sql +++ b/buildmimic/monetdb/monetdb_create_tables.sql @@ -1,8 +1,6 @@ -- ------------------------------------------------------------------ -- Title: Create the MIMIC-III tables -- Description: More detailed description explaining the purpose. --- MIMIC version: MIMIC-III v1.3 --- Created by: paris nicolas -- ------------------------------------------------------------------ CREATE SCHEMA mimiciii; diff --git a/buildmimic/monetdb/monetdb_load_data.sql b/buildmimic/monetdb/monetdb_load_data.sql index 1f2ca9570..bcadd8fb0 100644 --- a/buildmimic/monetdb/monetdb_load_data.sql +++ b/buildmimic/monetdb/monetdb_load_data.sql @@ -1,8 +1,6 @@ -- ------------------------------------------------------------------ -- Title: Load data into the MIMIC-III schema -- Description: More detailed description explaining the purpose. --- MIMIC version: MIMIC-III v1.3 --- Created by: paris nicolas -- ------------------------------------------------------------------ diff --git a/comorbidity/postgres/Makefile b/comorbidity/postgres/Makefile index c13c39b5a..ae4825445 100644 --- a/comorbidity/postgres/Makefile +++ b/comorbidity/postgres/Makefile @@ -1,8 +1,6 @@ ## ------------------------------------------------------------------ ## Title: Build file for comorbidity ## Description: Automated import of SQL scripts for comorbidity -## MIMIC version: MIMIC-III v1.3 -## Author: Jim Blundell 2016 ## ------------------------------------------------------------------ ## Parameters ## @@ -38,5 +36,3 @@ clean: @echo '--- Building' $< '---' @echo @$(PSQL) -f $< - - diff --git a/comorbidity/postgres/clean.sql b/comorbidity/postgres/clean.sql index 8c9ef973d..2bfb63e51 100644 --- a/comorbidity/postgres/clean.sql +++ b/comorbidity/postgres/clean.sql @@ -1,8 +1,6 @@ --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ -- Title: SQL clean script called by "make clean" -- Description: Drops all materialized views re: comorbidity scoring --- MIMIC version: All --- Author: Jim Blundell 2016 --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ DROP MATERIALIZED VIEW IF EXISTS ELIXHAUSER_AHRQ CASCADE; diff --git a/demographics/postgres/Makefile b/demographics/postgres/Makefile index 8e8d145cc..e844ddc7f 100644 --- a/demographics/postgres/Makefile +++ b/demographics/postgres/Makefile @@ -1,8 +1,6 @@ ## ------------------------------------------------------------------ ## Title: Build file for demographics ## Description: Automated import of SQL scripts for demographics -## MIMIC version: MIMIC-III v1.3 -## Author: Jim Blundell 2016 ## ------------------------------------------------------------------ ## Parameters ## @@ -37,5 +35,3 @@ clean: @echo '--- Building' $< '---' @echo @$(PSQL) -f $< - - diff --git a/demographics/postgres/clean.sql b/demographics/postgres/clean.sql index 3888bca20..136748164 100644 --- a/demographics/postgres/clean.sql +++ b/demographics/postgres/clean.sql @@ -1,10 +1,7 @@ --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ -- Title: SQL clean script called by "make clean" -- Description: Drops all materialized views re: demographics --- MIMIC version: All --- Author: Jim Blundell 2016 --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ DROP MATERIALIZED VIEW IF EXISTS icustay_detail CASCADE; DROP MATERIALIZED VIEW IF EXISTS heightweight CASCADE; - diff --git a/etc/Makefile b/etc/Makefile index cadc7517d..5e17af9ce 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,8 +1,6 @@ ## ------------------------------------------------------------------ ## Title: Build file for etc and etc/firstday ## Description: Automated import of SQL scripts for etc and etc/firstday -## MIMIC version: MIMIC-III v1.3 -## Author: Jim Blundell 2016 ## ------------------------------------------------------------------ ## Parameters ## @@ -42,4 +40,3 @@ clean: @echo '--- Building' $< '---' @echo @$(PSQL) -f $< - diff --git a/etc/clean.sql b/etc/clean.sql index ed0f856e3..b41621ef7 100644 --- a/etc/clean.sql +++ b/etc/clean.sql @@ -1,9 +1,7 @@ --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ -- Title: SQL clean script called by "make clean" -- Description: Drops all materialized views re: misc clinical concepts --- MIMIC version: All --- Author: Jim Blundell 2016 --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ DROP MATERIALIZED VIEW IF EXISTS ECHODATA CASCADE; DROP MATERIALIZED VIEW IF EXISTS rrt CASCADE; diff --git a/etc/firstday/Makefile b/etc/firstday/Makefile index 3bd6d23a0..97697cbf2 100644 --- a/etc/firstday/Makefile +++ b/etc/firstday/Makefile @@ -1,9 +1,7 @@ -## ------------------------------------------------------------------ +## ------------------------------------------------------------------ ## Title: Build file for etc/firstday ## Description: Automated import of SQL scripts for firstday -## MIMIC version: MIMIC-III v1.3 -## Author: Jim Blundell 2016 -## ------------------------------------------------------------------ +## ------------------------------------------------------------------ ## Parameters ## # The top-level Makefile settings take precedence over this @@ -35,4 +33,3 @@ clean: @echo '--- Building' $< '---' @echo @$(PSQL) -f $< - diff --git a/etc/firstday/blood-gas-first-day.sql b/etc/firstday/blood-gas-first-day.sql index a8e5cc2cb..9436a0552 100644 --- a/etc/firstday/blood-gas-first-day.sql +++ b/etc/firstday/blood-gas-first-day.sql @@ -1,5 +1,3 @@ --- This query is designed for MIMIC-III v1.3 - -- The aim of this query is to pivot entries related to blood gases and -- chemistry values which were found in LABEVENTS diff --git a/etc/firstday/clean.sql b/etc/firstday/clean.sql index 44072b262..f077c51c4 100644 --- a/etc/firstday/clean.sql +++ b/etc/firstday/clean.sql @@ -1,9 +1,7 @@ --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ -- Title: SQL clean script called by "make clean" -- Description: Drops all materialized views re: first day concepts --- MIMIC version: All --- Author: Jim Blundell 2016 --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ DROP MATERIALIZED VIEW IF EXISTS bloodgasfirstdayarterial CASCADE; DROP MATERIALIZED VIEW IF EXISTS bloodgasfirstday CASCADE; diff --git a/etc/firstday/urine-output-first-day.sql b/etc/firstday/urine-output-first-day.sql index 76fd49b66..4c89a5a12 100644 --- a/etc/firstday/urine-output-first-day.sql +++ b/etc/firstday/urine-output-first-day.sql @@ -1,8 +1,5 @@ -- ------------------------------------------------------------------ -- Purpose: Create a view of the urine output for each ICUSTAY_ID over the first 24 hours. --- Tested on MIMIC-III v1.2 --- Written by: Alistair E. W. Johnson --- References: TBA. -- ------------------------------------------------------------------ create materialized view uofirstday as diff --git a/etc/firstday/ventilation-first-day.sql b/etc/firstday/ventilation-first-day.sql index f94b3434c..a0bd667e8 100644 --- a/etc/firstday/ventilation-first-day.sql +++ b/etc/firstday/ventilation-first-day.sql @@ -1,7 +1,5 @@ -- Determines if a patient is ventilated on the first day of their ICU stay. -- Creates a table with the result. --- Contact: aewj@mit.edu --- Copyright 2015, Alistair Johnson CREATE MATERIALIZED VIEW ventfirstday AS -- group together the flags based on icustay_id @@ -112,7 +110,7 @@ select , case when ce.itemid = 648 and value = 'Intubated/trach' THEN 1 -- Speech = intubated else 0 end as SpeechIntubated - + from icustays ie left join chartevents ce on ie.icustay_id = ce.icustay_id and ce.value is not null diff --git a/sepsis/Makefile b/sepsis/Makefile index b97388719..1267d56eb 100644 --- a/sepsis/Makefile +++ b/sepsis/Makefile @@ -1,8 +1,6 @@ ## ------------------------------------------------------------------ ## Title: Build file for sepsis ## Description: Automated import of SQL scripts for sepsis -## MIMIC version: MIMIC-III v1.3 -## Author: Jim Blundell 2016 ## ------------------------------------------------------------------ ## Parameters ## @@ -39,5 +37,3 @@ clean: @echo '--- Building' $< '---' @echo @$(PSQL) -f $< - - diff --git a/sepsis/angus.sql b/sepsis/angus.sql index cfb66cf65..89caa9731 100644 --- a/sepsis/angus.sql +++ b/sepsis/angus.sql @@ -4,19 +4,17 @@ -- http://www.ncbi.nlm.nih.gov/pubmed/11445675 -- Case selection and definitions --- To identify cases with severe sepsis, we selected all acute care +-- To identify cases with severe sepsis, we selected all acute care -- hospitalizations with ICD-9-CM codes for both: --- (a) a bacterial or fungal infectious process AND --- (b) a diagnosis of acute organ dysfunction (Appendix 2). - --- By Sharukh Lokhandwala and Tom Pollard 2015 +-- (a) a bacterial or fungal infectious process AND +-- (b) a diagnosis of acute organ dysfunction (Appendix 2). -- Appendix 1: ICD9-codes (infection) CREATE MATERIALIZED VIEW angus_sepsis as WITH infection_group AS ( SELECT subject_id, hadm_id, - CASE + CASE WHEN substring(icd9_code,1,3) IN ('001','002','003','004','005','008', '009','010','011','012','013','014','015','016','017','018', '020','021','022','023','024','025','026','027','030','031', @@ -36,14 +34,14 @@ WITH infection_group AS ( -- Appendix 2: ICD9-codes (organ dysfunction) organ_diag_group as ( SELECT subject_id, hadm_id, - CASE + CASE -- Acute Organ Dysfunction Diagnosis Codes WHEN substring(icd9_code,1,3) IN ('458','293','570','584') THEN 1 WHEN substring(icd9_code,1,4) IN ('7855','3483','3481', - '2874','2875','2869','2866','5734') THEN 1 + '2874','2875','2869','2866','5734') THEN 1 ELSE 0 END AS organ_dysfunction, -- Explicit diagnosis of severe sepsis or septic shock - CASE + CASE WHEN substring(icd9_code,1,5) IN ('99592','78552') THEN 1 ELSE 0 END AS explicit_sepsis FROM MIMICIII.DIAGNOSES_ICD), @@ -51,7 +49,7 @@ WITH infection_group AS ( -- Mechanical ventilation organ_proc_group as ( SELECT subject_id, hadm_id, - CASE + CASE WHEN substring(icd9_code,1,4) IN ('9670','9671','9672') THEN 1 ELSE 0 END AS mech_vent FROM MIMICIII.PROCEDURES_ICD), @@ -60,11 +58,11 @@ WITH infection_group AS ( aggregate as ( SELECT subject_id, hadm_id, CASE - WHEN hadm_id in (SELECT DISTINCT hadm_id + WHEN hadm_id in (SELECT DISTINCT hadm_id FROM infection_group WHERE infection = 1) THEN 1 ELSE 0 END AS infection, - CASE + CASE WHEN hadm_id in (SELECT DISTINCT hadm_id FROM organ_diag_group WHERE explicit_sepsis = 1) THEN 1 @@ -89,4 +87,3 @@ SELECT subject_id, hadm_id, infection, WHEN infection = 1 AND mech_vent = 1 THEN 1 ELSE 0 END AS Angus FROM aggregate; - diff --git a/sepsis/clean.sql b/sepsis/clean.sql index 730001789..242327fd7 100644 --- a/sepsis/clean.sql +++ b/sepsis/clean.sql @@ -1,8 +1,6 @@ --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ -- Title: SQL clean script called by "make clean" -- Description: Drops all materialized views re: sepsis --- MIMIC version: All --- Author: Jim Blundell 2016 --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ DROP MATERIALIZED VIEW IF EXISTS angus_sepsis CASCADE; diff --git a/severityscores/Makefile b/severityscores/Makefile index 218883c86..6be23b429 100644 --- a/severityscores/Makefile +++ b/severityscores/Makefile @@ -1,8 +1,6 @@ ## ------------------------------------------------------------------ ## Title: Build file for severityscores ## Description: Automated import of SQL scripts for severityscores -## MIMIC version: MIMIC-III v1.3 -## Author: Jim Blundell 2016 ## ------------------------------------------------------------------ ## Parameters ## @@ -38,4 +36,3 @@ clean: @echo '--- Building' $< '---' @echo @$(PSQL) -f $< - diff --git a/severityscores/apsiii.sql b/severityscores/apsiii.sql index b56494b3c..7f88892cf 100644 --- a/severityscores/apsiii.sql +++ b/severityscores/apsiii.sql @@ -1,15 +1,9 @@ -- ------------------------------------------------------------------ -- Title: Acute Physiology Score III (APS III) --- MIMIC version: MIMIC-III v1.4 --- Originally written by: Alistair Johnson --- Contact: aewj [at] mit [dot] edu --- ------------------------------------------------------------------ - -- This query extracts the acute physiology score III. -- This score is a measure of patient severity of illness. -- The score is calculated on the first day of each ICU patients' stay. --- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. --- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. +-- ------------------------------------------------------------------ -- Reference for APS III: -- Knaus WA, Wagner DP, Draper EA, Zimmerman JE, Bergner M, Bastos PG, Sirio CA, Murphy DJ, Lotring T, Damiano A. @@ -35,6 +29,9 @@ -- 4) gcsfirstday - generated by gcs-first-day.sql -- 5) labsfirstday - generated by labs-first-day.sql +-- Note: +-- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. +-- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. -- List of TODO: -- The site of temperature is not incorporated. Axillary measurements should be increased by 1 degree. diff --git a/severityscores/clean.sql b/severityscores/clean.sql index 4990b2c62..8fd82a1dc 100644 --- a/severityscores/clean.sql +++ b/severityscores/clean.sql @@ -1,9 +1,7 @@ --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ -- Title: SQL clean script called by "make clean" -- Description: Drops all materialized views re: severity scores --- MIMIC version: All --- Author: Jim Blundell 2016 --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ DROP MATERIALIZED VIEW IF EXISTS APSIII CASCADE; DROP MATERIALIZED VIEW IF EXISTS LODS CASCADE; diff --git a/severityscores/lods.sql b/severityscores/lods.sql index 0e2256095..ef0b4518d 100644 --- a/severityscores/lods.sql +++ b/severityscores/lods.sql @@ -1,17 +1,9 @@ -- ------------------------------------------------------------------ -- Title: Logistic Organ Dysfunction Score (LODS) --- MIMIC version: MIMIC-III v1.4 --- Originally written as sofa.sql by: Alistair Johnson --- Edited as lods.sql by: Josh Gieringer --- Contact: aewj [at] mit [dot] edu --- Contact: joshua [dot] gieringer [at] digitalreasoning [dot] com --- ------------------------------------------------------------------ - -- This query extracts the logistic organ dysfunction system. -- This score is a measure of organ failure in a patient. -- The score is calculated on the first day of each ICU patients' stay. --- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. --- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. +-- ------------------------------------------------------------------ -- Reference for LODS: -- Le Gall, J. R., Klar, J., Lemeshow, S., Saulnier, F., Alberti, C., Artigas, A., & Teres, D. @@ -34,6 +26,10 @@ -- 5) labsfirstday - generated by labs-first-day.sql -- 5) bloodgasfirstdayarterial - generated by blood-gas-first-day-arterial.sql +-- Note: +-- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. +-- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. + CREATE MATERIALIZED VIEW LODS as -- extract CPAP from the "Oxygen Delivery Device" fields with cpap as diff --git a/severityscores/mlods.sql b/severityscores/mlods.sql index 1599aa555..9adaef701 100644 --- a/severityscores/mlods.sql +++ b/severityscores/mlods.sql @@ -1,12 +1,9 @@ -- ------------------------------------------------------------------ -- Title: Modified Logistic organ dysfunction system (mLODS) --- Originally written by: Alistair Johnson --- Contact: aewj [at] mit [dot] edu --- ------------------------------------------------------------------ - -- This query extracts a modified version of the logistic organ dysfunction system. -- This score was used in the third international definition of sepsis: Sepsis-3. -- This score is a measure of organ failure in a patient. +-- ------------------------------------------------------------------ -- Reference for LODS: -- Le Gall, J. R., Klar, J., Lemeshow, S., Saulnier, F., Alberti, C., Artigas, A., & Teres, D. @@ -28,6 +25,10 @@ -- Variables *excluded*, that are used in the original LODS: -- prothrombin time (PT), blood urea nitrogen, urine output +-- Note: +-- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. +-- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. + CREATE MATERIALIZED VIEW MLODS as -- extract CPAP from the "Oxygen Delivery Device" fields with cpap as diff --git a/severityscores/oasis.sql b/severityscores/oasis.sql index 87a4cf932..309b7d367 100644 --- a/severityscores/oasis.sql +++ b/severityscores/oasis.sql @@ -1,15 +1,9 @@ -- ------------------------------------------------------------------ -- Title: Oxford Acute Severity of Illness Score (OASIS) --- MIMIC version: MIMIC-III v1.4 --- Originally written by: Alistair Johnson --- Contact: aewj [at] mit [dot] edu --- ------------------------------------------------------------------ - -- This query extracts the Oxford acute severity of illness score. -- This score is a measure of severity of illness for patients in the ICU. -- The score is calculated on the first day of each ICU patients' stay. --- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. --- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. +-- ------------------------------------------------------------------ -- Reference for OASIS: -- Johnson, Alistair EW, Andrew A. Kramer, and Gari D. Clifford. @@ -33,6 +27,10 @@ -- Regarding missing values: -- The ventilation flag is always 0/1. It cannot be missing, since VENT=0 if no data is found for vent settings. +-- Note: +-- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. +-- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. + CREATE MATERIALIZED VIEW OASIS as with surgflag as diff --git a/severityscores/qsofa.sql b/severityscores/qsofa.sql index e80a813c2..31c360c2c 100644 --- a/severityscores/qsofa.sql +++ b/severityscores/qsofa.sql @@ -1,15 +1,9 @@ -- ------------------------------------------------------------------ -- Title: Quick Sequential Organ Failure Assessment (qSOFA) --- MIMIC version: MIMIC-III v1.3 --- Originally written by: Alistair Johnson --- Contact: aewj [at] mit [dot] edu --- ------------------------------------------------------------------ - --- This query extracts the quick sequential organ failure assessment (formally: sepsis-related organ failure assessment). +-- This query extracts the quick sequential organ failure assessment. -- This score was a recent revision of SOFA, aiming to detect patients at risk of sepsis. -- The score is calculated on the first day of each ICU patients' stay - though needn't be. --- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. --- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. +-- ------------------------------------------------------------------ -- Reference for qSOFA: -- Singer M, et al. The Third International Consensus Definitions for Sepsis and Septic Shock (Sepsis-3) @@ -22,6 +16,10 @@ -- 1) gcsfirstday - generated by gcs-first-day.sql -- 2) vitalsfirstday - generated by vitals-first-day.sql +-- Note: +-- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. +-- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. + CREATE MATERIALIZED VIEW QSOFA AS with scorecomp as ( diff --git a/severityscores/saps.sql b/severityscores/saps.sql index 4e39a2d20..0283b953f 100644 --- a/severityscores/saps.sql +++ b/severityscores/saps.sql @@ -1,18 +1,12 @@ -- ------------------------------------------------------------------ -- Title: Simplified Acute Physiology Score (SAPS) --- MIMIC version: MIMIC-III v1.4 --- Originally written by: Alistair Johnson --- Contact: aewj [at] mit [dot] edu --- ------------------------------------------------------------------ - -- This query extracts the simplified acute physiology score. -- This score is a measure of patient severity of illness. -- The score is calculated on the first day of each ICU patients' stay. --- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. --- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. +-- ------------------------------------------------------------------ -- Reference for SAPS: --- Jean-Roger Le Gall, Philippe Loirat, Annick Alperovitch, Paul Glaser, Claude Granthil, +-- Jean-Roger Le Gall, Philippe Loirat, Annick Alperovitch, Paul Glaser, Claude Granthil, -- Daniel Mathieu, Philippe Mercier, Remi Thomas, and Daniel Villers. -- "A simplified acute physiology score for ICU patients." -- Critical care medicine 12, no. 11 (1984): 975-977. @@ -31,6 +25,10 @@ -- 4) gcsfirstday - generated by gcs-first-day.sql -- 5) labsfirstday - generated by labs-first-day.sql +-- Note: +-- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. +-- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. + CREATE MATERIALIZED VIEW SAPS as -- extract CPAP from the "Oxygen Delivery Device" fields with cpap as diff --git a/severityscores/sapsii.sql b/severityscores/sapsii.sql index b360f0c1e..7f1d318f4 100644 --- a/severityscores/sapsii.sql +++ b/severityscores/sapsii.sql @@ -1,15 +1,9 @@ -- ------------------------------------------------------------------ -- Title: Simplified Acute Physiology Score II (SAPS II) --- MIMIC version: MIMIC-III v1.4 --- Originally written by: Alistair Johnson --- Contact: aewj [at] mit [dot] edu --- ------------------------------------------------------------------ - -- This query extracts the simplified acute physiology score II. -- This score is a measure of patient severity of illness. -- The score is calculated on the first day of each ICU patients' stay. --- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. --- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. +-- ------------------------------------------------------------------ -- Reference for SAPS II: -- Le Gall, Jean-Roger, Stanley Lemeshow, and Fabienne Saulnier. @@ -30,6 +24,10 @@ -- 4) gcsfirstday - generated by gcs-first-day.sql -- 5) labsfirstday - generated by labs-first-day.sql +-- Note: +-- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. +-- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. + CREATE MATERIALIZED VIEW SAPSII as -- extract CPAP from the "Oxygen Delivery Device" fields with cpap as diff --git a/severityscores/sirs.sql b/severityscores/sirs.sql index c4b952bb0..100e9f0a7 100644 --- a/severityscores/sirs.sql +++ b/severityscores/sirs.sql @@ -1,15 +1,9 @@ -- ------------------------------------------------------------------ -- Title: Systemic inflammatory response syndrome (SIRS) criteria --- MIMIC version: MIMIC-III v1.3 --- Originally written by: Alistair Johnson --- Contact: aewj [at] mit [dot] edu --- ------------------------------------------------------------------ - -- This query extracts the Systemic inflammatory response syndrome (SIRS) criteria -- The criteria quantify the level of inflammatory response of the body -- The score is calculated on the first day of each ICU patients' stay. --- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. --- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. +-- ------------------------------------------------------------------ -- Reference for SIRS: -- American College of Chest Physicians/Society of Critical Care Medicine Consensus Conference: @@ -30,6 +24,10 @@ -- 2) labsfirstday - generated by labs-first-day.sql -- 3) bloodgasfirstdayarterial - generated by blood-gas-first-day-arterial.sql +-- Note: +-- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. +-- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. + CREATE MATERIALIZED VIEW SIRS AS with bg as ( diff --git a/severityscores/sofa.sql b/severityscores/sofa.sql index d5a956daf..9b954d4ac 100644 --- a/severityscores/sofa.sql +++ b/severityscores/sofa.sql @@ -1,15 +1,9 @@ -- ------------------------------------------------------------------ -- Title: Sequential Organ Failure Assessment (SOFA) --- MIMIC version: MIMIC-III v1.4 --- Originally written by: Alistair Johnson --- Contact: aewj [at] mit [dot] edu --- ------------------------------------------------------------------ - -- This query extracts the sequential organ failure assessment (formally: sepsis-related organ failure assessment). -- This score is a measure of organ failure for patients in the ICU. -- The score is calculated on the first day of each ICU patients' stay. --- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. --- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. +-- ------------------------------------------------------------------ -- Reference for SOFA: -- Jean-Louis Vincent, Rui Moreno, Jukka Takala, Sheila Willatts, Arnaldo De Mendonça, @@ -33,6 +27,10 @@ -- 7) echodata - generated by echo-data.sql -- 8) ventdurations - generated by ventilation-durations.sql +-- Note: +-- The score is calculated for *all* ICU patients, with the assumption that the user will subselect appropriate ICUSTAY_IDs. +-- For example, the score is calculated for neonates, but it is likely inappropriate to actually use the score values for these patients. + CREATE MATERIALIZED VIEW SOFA AS with wt AS ( diff --git a/styleguide.md b/styleguide.md index a7d0fd179..14eca4196 100644 --- a/styleguide.md +++ b/styleguide.md @@ -9,14 +9,14 @@ This guide provides some general guidelines on formatting code for the MIMIC Cod Please include the following header information at the top of your code: ``` --- ------------------------------------------------------------------ --- Title: Short descriptive title. --- Description: More detailed description explaining the purpose. --- MIMIC version: Version of MIMIC (e.g. MIMIC-III v1.1). --- References: References to relevant academic papers etc (optional). --- ------------------------------------------------------------------ +-- ------------------------------------------------------------------ +-- Title: Short descriptive title. +-- Description: More detailed description explaining the purpose. +-- ------------------------------------------------------------------ ``` +We would also recommend adding in any relevant references or usage notes in the top of the query. + ## SQL - Always use uppercase for the reserved keywords like SELECT and WHERE. @@ -26,8 +26,4 @@ For more detail, following the guidelines at: http://www.sqlstyle.guide/ ## Python -Guidelines to follow... - - - - +Following PEP8 guidelines is recommended. Read more here: https://www.python.org/dev/peps/pep-0008/