Skip to content

Commit

Permalink
Merge pull request #66 from mit2400/master
Browse files Browse the repository at this point in the history
Solving build error by updating schema - "relation xxx does not exist"
  • Loading branch information
mmcdermott authored Oct 21, 2022
2 parents b7e9cea + 63585d4 commit d8d2dea
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions SQL_Queries/codes.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
SET SEARCH_PATH TO public,mimiciii;
SELECT
i.icustay_id, d.subject_id, d.hadm_id,
array_agg(d.icd9_code ORDER BY seq_num ASC) AS icd9_codes
FROM mimiciii.diagnoses_icd d
LEFT OUTER JOIN (SELECT ccs_matched_id, icd9_code from mimiciii.ccs_dx) c
FROM diagnoses_icd d
LEFT OUTER JOIN (SELECT ccs_matched_id, icd9_code from ccs_dx) c
ON c.icd9_code = d.icd9_code
INNER JOIN icustays i
ON i.hadm_id = d.hadm_id AND i.subject_id = d.subject_id
Expand Down
2 changes: 1 addition & 1 deletion SQL_Queries/debug_statics.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\echo "This file is just for debugging"
SET search_path TO mimiciii;
SET search_path TO public,mimiciii;
select distinct
i.subject_id,
i.hadm_id,
Expand Down
2 changes: 1 addition & 1 deletion mimic_direct_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ def plot_variable_histograms(col_names, df):
help='Postgres host. Try "/var/run/postgresql/" for Unix domain socket errors.')
ap.add_argument('--psql_dbname', type=str, default='mimic',
help='Postgres database name.')
ap.add_argument('--psql_schema_name', type=str, default='mimiciii',
ap.add_argument('--psql_schema_name', type=str, default='public,mimiciii',
help='Postgres database name.')
ap.add_argument('--psql_user', type=str, default=None,
help='Postgres user.')
Expand Down
2 changes: 1 addition & 1 deletion mimic_querier.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(
self,
exclusion_criteria_template_vars={},
query_args={}, # passed wholesale to psycopg2.connect
schema_name='mimiciii'
schema_name='public,mimiciii'
):
""" A class to facilitate repeated Queries to a MIMIC psql database """
self.exclusion_criteria_template_vars = {}
Expand Down
2 changes: 1 addition & 1 deletion utils/niv-durations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- events can then be used for various purposes: calculating the total duration
-- of mechanical ventilation, cross-checking values (e.g. PaO2:FiO2 on vent), etc

SET SEARCH_PATH TO 'mimiciii';
SET SEARCH_PATH TO public,mimiciii;

-- The query's logic is roughly:
-- 1) The presence of a mechanical ventilation setting starts a new ventilation event
Expand Down
2 changes: 1 addition & 1 deletion utils/setup_user_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mkdir -p $MIMIC_EXTRACT_OUTPUT_DIR

export DBUSER=bnestor
export DBNAME=mimic
export SCHEMA=mimiciii
export SCHEMA=public,mimiciii
export HOST=mimic
export DBSTRING="dbname=$DBNAME options=--search_path=$SCHEMA"
alias psql="psql -h $HOST -U $DBUSER "
Expand Down

0 comments on commit d8d2dea

Please sign in to comment.