|
| 1 | +--- |
| 2 | +title: "BigQuery" |
| 3 | +layout: default |
| 4 | +parent: "Cloud" |
| 5 | +grand_parent: "Getting Started" |
| 6 | +nav_order: 3 |
| 7 | +description: "Access MIMIC IV on BigQuery." |
| 8 | +--- |
| 9 | + |
| 10 | +# BigQuery |
| 11 | + |
| 12 | +BigQuery is a columnar, distributed relational database management system. BigQuery accesses only the columns specified in the query, making it ideal for data analysis workflows. [Read more about BigQuery in Google's cloud documentation](https://cloud.google.com/bigquery/). |
| 13 | + |
| 14 | +First, ensure you have been provisioned access to MIMIC III or IV on BigQuery. See the [cloud page for instructions](../../cloud). Once you have been provisioned access to using MIMIC on BigQuery, it's worthwhile to "pin" the dataset to see it on the BigQuery web tool. |
| 15 | + |
| 16 | +1. Go to the BigQuery console: http://console.cloud.google.com/bigquery |
| 17 | +2. If you haven't created a BigQuery project previously you will be asked to do so. You will need to enter information to pay for the cost of queries. For more details see: https://cloud.google.com/resource-manager/docs/creating-managing-projects |
| 18 | +3. On the left sidebar, next to "Explorer", click "+ ADD DATA". Click "Star a project by name". |
| 19 | +4. Type `physionet-data` and enter it in. |
| 20 | +5. In the sidebar on the left, you should now see the `physionet-data` project. Click the arrow to the left of `physionet-data` to expand the project. |
| 21 | +6. You should now see a number of datasets. Which datasets you see depends on the access provisioned to you. |
| 22 | + * At a minimum, you will see the demo projects: `eicu_crd_demo` and `mimiciii_demo`. |
| 23 | + * If you have successfully requested access to MIMIC-III, you will additionally see `mimiciii_clinical`, `mimiciii_demo`, `mimiciii_notes`, and `mimiciii_derived`. |
| 24 | + * If you have successfully requested access to MIMIC-IV, you will additionally see `mimiciv_icu` and `mimiciv_hosp`. |
| 25 | + * If you have successfully requested access to MIMIC-IV-ED, you will additionally see `mimiciv_ed`. |
| 26 | + * If you have successfully requested access to MIMIC-IV-Note, you will additionally see `mimiciv_note`. |
| 27 | + |
| 28 | +You are now ready to query the data! Try a simple query in the main dialogue box, while logged in under your project that pays for queries. |
| 29 | + |
| 30 | +```sql |
| 31 | +SELECT * |
| 32 | +FROM `physionet-data.mimiciv_hosp.patients` |
| 33 | +WHERE subject_id < 10000100 |
| 34 | +ORDER BY subject_id |
| 35 | +``` |
| 36 | + |
| 37 | +The query should return some data, and your browser window should be similar to the below: |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +At this point you are ready to use MIMIC on BigQuery! |
| 42 | + |
| 43 | +A tutorial on using BigQuery to query MIMIC-III is available [here](/docs/iii/tutorials/intro-to-mimic-iii-bq). |
| 44 | + |
| 45 | +Note that we have a number of pre-generated "views" of the data. These are available in the `mimiciv_derived` dataset which you are free to query. All code used to generate these views has been made openly available on the [MIMIC-IV code repository](https://github.com/MIT-LCP/mimic-iv/). |
| 46 | + |
| 47 | +If you are having issues, see the [Troubleshooting section](#troubleshooting). |
| 48 | + |
| 49 | +## Troubleshooting |
| 50 | + |
| 51 | +### I get a pop-up about Terms of Service |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +You will need to agree to all GCP Terms of Service and adhere to their terms in order to use the data on BigQuery. |
| 56 | + |
| 57 | +### When I go to BigQuery, it asks me to create a project |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +Almost all of your interactions with GCP are associated with a *project*. Importantly, all billing for your usage must be allotted to a single project. |
| 62 | +In order to use BigQuery you must have an activate project associated with your account. BigQuery offers a $300 free trial for first time users. |
| 63 | + |
| 64 | +Create a project and select it as your activate project. If you've done this correctly, then the top bar of the Google console page should stop saying "Select a project", and instead have your project name. For example, in the below, I have selected the project `alistairewj`, which is now the activate project: |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +### I can only see `eicu_crd_demo` and `mimiciii_demo` |
| 70 | + |
| 71 | +These datasets are fully public, so the implication is that you have not been granted access to the full versions of the databases. |
| 72 | +Please (1) double check you have entered your cloud information into your PhysioNet profile, verifying any e-mails as needed, and (2) requested access to the specific cloud project on its respective PhysioNet project page. |
| 73 | + |
| 74 | +### I want to ask a question about MIMIC or raise an issue on the MIMIC Code Repository |
| 75 | + |
| 76 | +If none of the above have the answer, feel free to [raise an issue](https://github.com/MIT-LCP/mimic-code/issues) or [ask for advice](https://github.com/MIT-LCP/mimic-code/discussions) in the MIMIC repository. |
0 commit comments