MIMIC数据库注册+数据获取流程详解

官方
阅读 317 0 收藏 0 2025-05-21 19:00:00

1.MIMIC数据下载

登录CITI项目网站,网站地址:

https://physionet.org/content/mimiciv/3.1/进行注册。

注册完之后考试答题正确率需达到90%,可以⽆限次地做,提交⼀次它就会给出正确的答案,记录下答案就⾏。

完成考试后下拉,会出现成绩单(左),点击下载(证书是3年有效的,因为数据库使⽤权每次申请只有1年,以后还要⽤到这份证书,因此,需注意保存好该⽂件)。

注册PhysioNet账号

注意事项:身份不能填写学生;申请理由不要出现学生、老师、课程等敏感词汇。

完成数据库权限的申请后就需要下载配置数据。最常用的配置语言为PostgreSQL。

2.数据下载:用SQL语言进行数据提取

代码文本:

---样本对象 第一次入院且第一次进入ICU(65366人)
select *frommimiciv_derived.icustay_detail_new
select distinct stay_id frommimiciv_derived.icustay_detail_new where icustay_seq=1andhospstay_seq=1
---疾病  脓毒症(27882人)
select distinct subject_id,sepsis3 frommimiciv_derived.sepsis3
        where stay_id in(select distinct stay_id frommimiciv_derived.icustay_detail_new where icustay_seq=1andhospstay_seq=1)
--次要结局(死亡)
select *frommimiciv_derived.icustay_detail_outcome
select distinct subject_id,status_30d,time_30d,status_90d,time_90d,status_1year,time_1year frommimiciv_derived.icustay_detail_outcome
where stay_id in(select distinct stay_id frommimiciv_derived.icustay_detail_new where icustay_seq=1andhospstay_seq=1)
--基本信息
select distinct subject_id,gender,race,admission_age,los_icu frommimiciv_derived.icustay_detail_new
where stay_id in(select distinct stay_id frommimiciv_derived.icustay_detail_new where icustay_seq=1andhospstay_seq=1)

数据的合并,以R语言为例,一般根据subject id的共同项,用循环语句将所有文件合并。

代码文本:

#设置工作路径
setwd("D:\\右美托咪定和心力衰竭\\数据")
####读取合并数据
library(dplyr)
library(foreign)
filenames<-list.files()
data<-read.csv(filenames[1])
for(i in2:length(filenames)){
  data1<-read.csv(filenames[i],na.strings ="NULL")
  data<-merge(data,data1,by="subject_id",all=TRUE)
  data<-data[!duplicated(data$subject_id),]
}

评论列表

发表评论