Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
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
{{ message }}
JXtreehouse
Python_script
Repository navigation
Code
Issues
1
(1)
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
Python_script
/
heart_disease_case_analysis.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
46 lines (37 loc) · 1.42 KB
main
Breadcrumbs
Python_script
/
heart_disease_case_analysis.py
Copy path
Top
File metadata and controls
Code
Blame
46 lines (37 loc) · 1.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import psycopg2
schema_name = 'mimic'
# 连接到MIMIC-IV数据库
conn = psycopg2.connect(dbname='mimiciv', user='postgres', password='mimic',
host='10.234.211.51', port=5432)
query_schema = 'SET search_path to ' + schema_name + ';'
# # # 设置查询语句
# # # 我们选择从mimiciv_hosp.admissions表中提取hadm_id等于10006的行。
# # # 在写sql代码时,最好先执行“set search_path to mimiciv" 随后的所有操作均不需要指明表格的位置;否则,任何操作都应该在表格名前面加前缀mimiciv
# query1 = query_schema + 'SELECT subject_id, hadm_id, admittime, dischtime, admission_type FROM mimiciv_hosp.admissions'
#
# # 运行查询并将结果分配给变量
# admissions_pd = pd.read_sql_query(query1,conn)
# admissions_pd.head()
# print(admissions_pd.head())
query = """
SELECT de.stay_id
, (strftime('%s',de.charttime)-strftime('%s',ie.intime))/60.0/60.0 as HOURS
, di.label
, de.value
, de.valuenum
, de.uom
FROM mimiciv_icu.chartevents de
INNER join mimiciv_icu.d_items di
ON de.itemid = di.itemid
INNER join mimiciv_icu.icustays ie
ON de.stay_id = ie.stay_id
WHERE de.stay_id = 252522
ORDER BY charttime;
"""
ce = pd.read_sql_query(query,conn)
# OPTION 2: load chartevents from a CSV file
# ce = pd.read_csv('data/example_chartevents.csv', index_col='HOURSSINCEADMISSION')
print(ce.head())
You can’t perform that action at this time.