Skip to content

Commit

Permalink
0.0.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfjs committed Aug 5, 2024
0 parents commit 07457a5
Show file tree
Hide file tree
Showing 40 changed files with 3,325 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changes/0.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## 0.0.1 - 2024-07-31
### Added
* Initial commit
* README, CHANGELOG, LICENSE
* Initial folder structure
* Initial library added to `src`
* Dockerfiles and docker-compose
6 changes: 6 additions & 0 deletions .changes/0.0.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 0.0.2 - 2024-07-31
### Added
* Added resource limits to docker-compose
### Changed
* Removed comments in SQL scripts as its causing issues
* Progressed MIMIC data version to 2.2, updated SQL scripts to match
5 changes: 5 additions & 0 deletions .changes/0.0.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 0.0.3 - 2024-07-31
### Added
* MIMIC-IV Postgres Functions
### Changed
* Allowing MIMIC-IV 2.0 backwards compatibility
7 changes: 7 additions & 0 deletions .changes/0.0.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## 0.0.4 - 2024-08-05
### Added
* MIMIC-ED Import Option Closes Issue #5
### Changed
* README to correctly reflect volume location Closes Issue #16
* Updated `docker-compose.yaml` to use env var for data folder
* Changed the library name to `pgmimic` Closes Issue #16
6 changes: 6 additions & 0 deletions .changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
Empty file added .changes/unreleased/.gitkeep
Empty file.
26 changes: 26 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
kindFormat: '### {{.Kind}}'
changeFormat: '* {{.Body}}'
kinds:
- label: Added
auto: minor
- label: Changed
auto: major
- label: Deprecated
auto: minor
- label: Removed
auto: major
- label: Fixed
auto: patch
- label: Security
auto: patch
newlines:
afterChangelogHeader: 1
beforeChangelogVersion: 1
endOfVersion: 1
envPrefix: CHANGIE_
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_USER=mimic
POSTGRES_PASSWORD=mimic123
POSTGRES_DB=postgres
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## DATA FOLDER ##
data/
!data/README.md

## bin ##
bin/notes.md

## PYTHON ##
__pycache__/*
*/__pycache__/*
__pycache__

## JetBrains ##
.idea/*
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).


## 0.0.4 - 2024-08-05
### Added
* MIMIC-ED Import Option Closes Issue #5
### Changed
* README to correctly reflect volume location Closes Issue #16
* Updated `docker-compose.yaml` to use env var for data folder
* Changed the library name to `pgmimic` Closes Issue #16

## 0.0.3 - 2024-07-31
### Added
* MIMIC-IV Postgres Functions
### Changed
* Allowing MIMIC-IV 2.0 backwards compatibility

## 0.0.2 - 2024-07-31
### Added
* Added resource limits to docker-compose
### Changed
* Removed comments in SQL scripts as its causing issues
* Progressed MIMIC data version to 2.2, updated SQL scripts to match

## 0.0.1 - 2024-07-31
### Added
* Initial commit
* README, CHANGELOG, LICENSE
* Initial folder structure
* Initial library added to `src`
* Dockerfiles and docker-compose
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# How to contribute

Thank you for your interest in our little project. I appreciate any support to help improve this project.

## How to Contribute

1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Make your changes in the new branch.
4. Submit a [pull request (PR)](https://github.com/rudolfjs/PostgresMimicImporter/pull/new/master) to the main repository.

## Pull Request Guidelines

When [submitting a pull request](https://github.com/rudolfjs/PostgresMimicImporter/pull/new/master) please ensure that:

1. You clearly describe the problem you're solving or the feature you're adding, linking to [issue](https://github.com/rudolfjs/PostgresMimicImporter/issues).
2. You outline the changes you've made in detail.
3. Please make sure your code is formatted using [psf/black](https://github.com/psf/black)

## Review Process

Once you've submitted a pull request:

1. The project maintainers will review your changes.
2. Maintainers may ask for additional changes or clarifications.
3. Once approved, your contribution will be merged into the project.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Rudolf J

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
113 changes: 113 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Postgres MIMIC Importer

<a href="/LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/MIT-purple?style=for-the-badge&label=LICENSE"></a>
<a href="https://www.python.org/downloads/"><img alt="Python Version: 3.8plus" src="https://img.shields.io/badge/3.10-green?style=for-the-badge&label=Python&logo=python"></a>
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/black-black?style=for-the-badge&label=Code%20Style"></a>

****

MIMIC data importer for PostgreSQL.

This repository **does not** contain **any** `MIMIC` data.

## Data

The location of the `MIMIC` is to be set as an environment variable before running `docker-compose`.

### Data Preparation

As `MIMIC-IV` and `MIMIC-IV-ED` are separate downloads, please ensure that all data is copied into a single target folder.

The target folder must have the following structure:

```bash
.
data
└───mimiciv
└───<version>
├───ed
├───hosp
└───icu
```

If you do not require `MIMIC-IV-ED` data to be imported, edit the `config.json` file to remove the import.

### Set the target location

Using the environment variable (default):

#### Windows

PowerShell:
```PowerShell
$env:MIMIC_DATA_PATH = "C:/absolute/path/to/mimic/data"
```

Command Prompt:

```commandline
set MIMIC_DATA_PATH=C:/absolute/path/to/mimic/data
```

#### Linux

```Bash
export MIMIC_DATA_PATH=/absolute/path/to/mimic/data
```

The `docker-compose.yaml` can be edited to hard code the location:

```yaml
version: "3"
services:
mimic_import:
volumes:
- /absolute/path/to/mimic/data/:/usr/src/app/data
```
### Compatible Data Versions
| MIMIC Dataset | Version Compatibility |
|:--------------|:----------------------|
| MIMIC-IV | 2.0 |
| MIMIC-IV-ED | 2.0 |
| MIMIC-IV | 2.2 |
| MIMIC-IV-ED | 2.2 |
## Build MIMIC-IV database services
```bash
docker-compose build
```

The service can be started and stopped after being built:

1. Start the service: `docker-compose up`
* Start the service as a background daemon: `docker-compose up -d`
2. Stop the service: `docker-compose down`
3. Stop the service and remove data: `docker-compose down -v`

## License
```license
MIT License
Copyright (c) 2024 Rudolf J
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
66 changes: 66 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"database": {
"type": "postgresql+asyncpg",
"host": "pg",
"port": 5432,
"database": "postgres",
"schema": "public"
},

"data": {
"location": "./data/mimiciv",
"version": "2.2",
"schemas": [
"mimic_hosp",
"mimic_icu",
"mimiciv_ed",
"mimic_derived"
],
"tables": {
"mimic_hosp": [
"admissions",
"d_hcpcs",
"diagnoses_icd",
"d_icd_diagnoses",
"d_icd_procedures",
"d_labitems",
"emar_detail",
"emar",
"hcpcsevents",
"labevents",
"microbiologyevents",
"omr",
"patients",
"pharmacy",
"poe_detail",
"poe",
"prescriptions",
"procedures_icd",
"transfers"
],
"mimic_icu": [
"chartevents",
"datetimeevents",
"d_items",
"icustays",
"ingredientevents",
"inputevents",
"outputevents",
"procedureevents"
],
"mimiciv_ed": [
"diagnosis",
"edstays",
"medrecon",
"pyxis",
"triage",
"vitalsign"
],
"mimic_derived": {
"demographics": [
"age"
]
}
}
}
}
Loading

0 comments on commit 07457a5

Please sign in to comment.