diff --git a/modules/cold-extraction/Dockerfile b/modules/cold-extraction/Dockerfile new file mode 100644 index 0000000..d9fe912 --- /dev/null +++ b/modules/cold-extraction/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.10.10-bullseye + +# download and add DCM4CHE +ADD https://sourceforge.net/projects/dcm4che/files/dcm4che3/5.22.5/dcm4che-5.22.5-bin.zip/download /opt/dcm4che-5.22.5-bin.zip +RUN set -eux; \ +# install JRE for DCM4CHE, mailutils + apt update && \ + apt install -y openjdk-11-jre mailutils && \ +# extract and install DCM4CHE + cd /opt; \ + unzip dcm4che-5.22.5-bin.zip && \ + rm dcm4che-5.22.5-bin.zip; \ +# create default dicom storage directory + mkdir -p /opt/data/new-study + +COPY . /usr/src/niffler-cold-extraction +WORKDIR /usr/src/niffler-cold-extraction + +# install required python packages +RUN pip install -r requirements.txt + +CMD ["python", "ColdDataRetriever.py"] diff --git a/modules/cold-extraction/README.md b/modules/cold-extraction/README.md index d8bbd0b..7dfb0f4 100644 --- a/modules/cold-extraction/README.md +++ b/modules/cold-extraction/README.md @@ -345,3 +345,28 @@ nohup /opt/dcm4che-5.22.5/bin/movescu -c "AE_ARCH2@xx.yy.ww.zz:104" -b "QBNIFFLE If the testing with DCM4CHE as above does not work, that is an issue likely with your PACS configuration to send DICOM data to your endpoint. Please get the above to work first in that case before attempting the execution with Niffler. +## Using Docker + +To use as a docker container, first navigate to this directory (`modules/cold-extraction`) and build the image. + +``` +cd modules/cold-extraction +docker build -t niffler/cold-extraction . +``` + +Then, run using the image tag used above. + +``` +docker run --network pacs_network --rm niffler/cold-extraction +``` + +Replace `pacs_network` with the docker network where the PACS is reachable. + +When the configuration or system JSON, as well as the CSV files change, either rebuild the image or mount as a volume before running the container. + +For ease, a docker compose file is also included. After configuring the volumes, networks, and everything else on the `docker-compose.yml` file, simply run: + +``` +docker compose up +``` + diff --git a/modules/cold-extraction/docker-compose.yml b/modules/cold-extraction/docker-compose.yml new file mode 100644 index 0000000..3986697 --- /dev/null +++ b/modules/cold-extraction/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.1' +services: + niffler-cold-extraction: + build: . + volumes: + - ./config.json:/usr/src/niffler-cold-extraction/config.json + - ./system.json:/usr/src/niffler-cold-extraction/system.json + - ./csv/:/usr/src/niffler-cold-extraction/csv/ + - ./storage:/opt/data/new-study + networks: + - default diff --git a/modules/cold-extraction/requirements.txt b/modules/cold-extraction/requirements.txt new file mode 100644 index 0000000..3cf9eb9 --- /dev/null +++ b/modules/cold-extraction/requirements.txt @@ -0,0 +1,4 @@ +schedule +pandas +pynetdicom +pydicom \ No newline at end of file diff --git a/modules/frontend/requirements.txt b/modules/frontend/requirements.txt index 62b17d1..53609a2 100644 --- a/modules/frontend/requirements.txt +++ b/modules/frontend/requirements.txt @@ -1,7 +1,7 @@ bidict==0.21.2 click==8.0.1 colorama==0.4.4 -Flask==2.0.1 +Flask==2.3.2 Flask-Login==0.5.0 Flask-SocketIO==4.3.2 Flask-SQLAlchemy==2.5.1 @@ -21,5 +21,5 @@ pytz==2021.1 schedule==1.1.0 six==1.16.0 SQLAlchemy==1.4.18 -sqlparse==0.4.2 +sqlparse==0.4.4 Werkzeug==2.2.3 diff --git a/modules/meta-extraction/Dockerfile b/modules/meta-extraction/Dockerfile new file mode 100644 index 0000000..52ee809 --- /dev/null +++ b/modules/meta-extraction/Dockerfile @@ -0,0 +1,25 @@ +FROM python:3.10.10-bullseye + +# install JRE for DCM4CHE +RUN set -eux; \ + apt update && \ + apt install -y openjdk-11-jre + +# install DCM4CHE +RUN set -eux; \ + cd /opt; \ + curl -L https://sourceforge.net/projects/dcm4che/files/dcm4che3/5.22.5/dcm4che-5.22.5-bin.zip/download \ + -o dcm4che-5.22.5-bin.zip; \ + unzip dcm4che-5.22.5-bin.zip && \ + rm dcm4che-5.22.5-bin.zip + +COPY . /usr/src/app +WORKDIR /usr/src/app + +# install required python packages +RUN pip install -r requirements.txt + +# create default dicom storage directory +RUN mkdir /opt/niffler-dicom-root + +CMD ["python", "MetadataExtractor.py"] diff --git a/modules/meta-extraction/docker-compose.yml b/modules/meta-extraction/docker-compose.yml new file mode 100644 index 0000000..4e2fff7 --- /dev/null +++ b/modules/meta-extraction/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3' +services: + niffler-meta-extraction: + build: . + environment: + MONGO_URI: user:password@mongo:27017 + mongo: + image: mongo:5.0 + environment: + MONGO_INITDB_ROOT_USERNAME: user + MONGO_INITDB_ROOT_PASSWORD: password diff --git a/modules/meta-extraction/requirements.txt b/modules/meta-extraction/requirements.txt new file mode 100644 index 0000000..3fdd1db --- /dev/null +++ b/modules/meta-extraction/requirements.txt @@ -0,0 +1,5 @@ +pymongo +pydicom +schedule +pandas +requests