Skip to content

Commit c8d5990

Browse files
committed
update to match mimic-iv-ed, remove extra sections
1 parent 5ada4ae commit c8d5990

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

mimic-iv-ed/buildmimic/postgres/README.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ psql -f create.sql
2424
```
2525

2626
Afterwards, we need to load the MIMIC-IV-ED files into the database. To do so, we'll specify the location of the local CSV files (compressed or uncompressed).
27-
Note that this assumes the folder `mimic_data_dir` contains all the `csv` or `csv.gz` files.
27+
Note that this assumes the folder `mimic_data_dir` contains all the `csv` or `csv.gz` files. If using compressed files (`.csv.gz`), use the `load_gz.sql` script instead of the `load.sql` script.
2828

2929
Once you have verified all data files are present, run:
3030

@@ -40,39 +40,28 @@ psql -v ON_ERROR_STOP=1 -v mimic_data_dir=<INSERT MIMIC FILE PATH HERE> -f load.
4040
Optionally, you can specify the database name with the `-d` argument. First, you must create the database if it does not already exist:
4141

4242
```sh
43-
createdb mimicived
43+
createdb mimic
4444
```
4545

4646
After the database exists, the schema and tables can be created under this database as follows:
4747

4848
```sh
49-
psql -d mimicived -f create.sql
49+
psql -d mimic -f create.sql
5050
```
5151

5252
Finally, loading the data into this data requires specifying the database name with `-d mimicived` again:
5353

5454
```sh
55-
psql -d mimicived -v ON_ERROR_STOP=1 -v mimic_data_dir=<INSERT MIMIC FILE PATH HERE> -f load.sql
55+
psql -d mimic -v ON_ERROR_STOP=1 -v mimic_data_dir=<INSERT MIMIC FILE PATH HERE> -f load.sql
5656
```
5757

58-
### Error creating schema
59-
60-
```sql
61-
psql:postgres_create_tables.sql:12: ERROR: syntax error at or near "NOT"
62-
LINE 1: CREATE SCHEMA IF NOT EXISTS mimiciii;
63-
```
64-
65-
The `IF NOT EXISTS` syntax was introduced in PostgreSQL 9.3. Make sure you have the latest PostgreSQL version. While one possible option is to modify the code here to be function under earlier versions, we highly recommend upgrading as most of the code written in this repository uses materialized views (which were introduced in PostgreSQL version 9.4).
66-
6758
### Peer authentication failed
6859

69-
If during `make mimic-build` you encounter following error:
60+
If you encounter following error:
7061

7162
```bash
72-
psql "dbname=mimic user=postgres options=--search_path=mimiciii" -v ON_ERROR_STOP=1 -f postgres_create_tables$(psql --version | perl -lne 'print "_pg10" if / 10.\d+/').sql
63+
psql "dbname=mimic user=postgres options=--search_path=mimic_ed" -v ON_ERROR_STOP=1 -f create.sql
7364
psql: FATAL: Peer authentication failed for user "postgres"
74-
Makefile:110: recipe for target 'mimic-build' failed
75-
make: *** [mimic-build] Error 2
7665
```
7766

7867
... this indicates that the database exists, but the script failed to login as the user `postgres`. By default, postgres installs itself with a user called `postgres`, and only allows "peer" authentication: logging in with the same username as your operating system username. Consequently, a common issue users have is being unable to access the database with the default postgres users.
@@ -99,14 +88,14 @@ systemctl restart postgresql.service
9988
### NOTICE
10089

10190
```sql
102-
NOTICE: materialized view "XXXXXX" does not exist, skipping
91+
NOTICE: table "XXXXXX" does not exist, skipping
10392
```
10493

10594
This is normal. By default, the script attempts to delete tables before rebuilding them. If it cannot find the table to delete, it outputs a notice letting the user know.
10695

10796
## Older versions of PostgreSQL
10897

109-
If you have an older version of PostgreSQL, then it is still possible to load MIMIC, but modifications to the scripts are required. In particular, the scripts use declarative partitioning for larger tables to speed up queries. To read more about [declarative partitioning, see the PostgreSQL documentation](https://www.postgresql.org/docs/10/static/ddl-partitioning.html#DDL-PARTITIONING-DECLARATIVE). You can remove declarative partitionining by modifying the create script, and removing it for each affected table. For example, chartevents uses declarative partitioning, and thus the create.sql script creates many partitions for chartevents: chartevents_01, chartevents_02, ..., etc. Replacing these with a single create statement for chartevents will make the script compatible for older versions of PostgreSQL.
98+
If you have an older version of PostgreSQL, then it is still possible to load MIMIC, but modifications to the scripts are required. In particular, the scripts use declarative partitioning for larger tables to speed up queries. To read more about [declarative partitioning, see the PostgreSQL documentation](https://www.postgresql.org/docs/10/static/ddl-partitioning.html#DDL-PARTITIONING-DECLARATIVE). You can remove declarative partitionining by modifying the create script, and removing it for each affected table. For example, chartevents in the `mimic_icu` schema uses declarative partitioning, and thus the create.sql script creates many partitions for chartevents: chartevents_01, chartevents_02, ..., etc. Replacing these with a single create statement for chartevents will make the script compatible for older versions of PostgreSQL.
11099

111100
### Other
112101

0 commit comments

Comments
 (0)