Skip to content

Commit

Permalink
Merge pull request #65 from pennsignals/flowsheets
Browse files Browse the repository at this point in the history
Add flowsheets
  • Loading branch information
mdbecker authored Jan 26, 2022
2 parents d6513c8 + f8243e0 commit 80f7a25
Show file tree
Hide file tree
Showing 24 changed files with 844 additions and 1,132 deletions.
7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-symlinks
Expand All @@ -26,22 +26,25 @@ repos:
hooks:
- id: black
language_version: python3.9
types: [python]
- repo: https://github.com/pycqa/pylint
rev: v2.12.2
hooks:
- id: pylint
language: system
types: [python]
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
language: system
# - repo: https://github.com/python/mypy
types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.930
hooks:
- id: mypy
language: system
types: [python]
- repo: local
hooks:
- id: pytest
Expand Down
57 changes: 5 additions & 52 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,59 +30,12 @@ services:
build:
context: .
target: test
depends_on:
- postgres
- notifier
- verifier
- epic
environment:
- CONFIG=/local/test.yaml
- ENV=/local/docker.env
- CONFIG=./local/test.yaml
- ENV=./secrets/example.env
volumes:
- ./assets:/assets
- ./gold:/gold
- ./local:/local

notifier:
build:
context: .
target: epic
command: epic.notify
depends_on:
- epic
- postgres
environment:
- CONFIG=/local/notifier.yaml
- ENV=/local/docker.env
volumes:
- ./assets:/assets
- ./local:/local

verifier:
build:
context: .
target: epic
command: epic.verify
depends_on:
- epic
- postgres
environment:
- CONFIG=/local/verifier.yaml
- ENV=/local/docker.env
volumes:
- ./assets:/assets
- ./local:/local

epic:
build:
context: .
target: epic
environment:
- CONFIG=/local/epic.yaml
- ENV=/local/docker.env
expose:
- "80"
ports:
- "80:80"
restart: always
volumes:
- ./local:/local
- ./model:/model
- ./secrets:/secrets
17 changes: 5 additions & 12 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,15 @@ RUN \
apt-get -qq autoremove -y --purge && \
rm -rf /var/lib/apt/lists/*

FROM python:3.9.9-slim-bullseye as epic
LABEL name="epic"
WORKDIR /tmp
ENV FREETDS /etc/freetds
ENV PATH /root/.local/bin:$PATH
COPY --from=build /root/.local /root/.local
COPY --from=build /tmp/assets /tmp/assets
COPY --from=build /usr/bin/tini /usr/bin
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["epic"]

FROM build as test
ARG IFLAGS
LABEL name="dsdk.test"
WORKDIR /tmp
RUN \
pip install ${IFLAGS} ".[all]"
pip install ${IFLAGS} ".[all]" && \
ln -s /local ./local && \
ln -s /secrets ./secrets && \
ln -s /model ./model && \
ln -s /gold ./gold
ENTRYPOINT [ "/usr/bin/tini", "--" ]
CMD [ "pre-commit", "run", "--all-files" ]
5 changes: 2 additions & 3 deletions local/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*
!.gitignore
!configuration.yaml
!notifier.yaml
!verifier.yaml
!epic.yaml
!docker.yaml
!test.yaml
16 changes: 14 additions & 2 deletions local/configuration.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
!example
flowsheets: !flowsheets
client_id: ${EPIC_CLIENT_ID}
cookie: ${EPIC_COOKIE}
flowsheet_id: ${EPIC_FLOWSHEET_ID}
flowsheet_template_id: ${EPIC_FLOWSHEET_TEMPLATE_ID}
password: ${EPIC_PASSWORD}
url: ${EPIC_URL}api/epic/2011/clinical/patient/addflowsheetvalue/flowsheetvalue
username: ${EPIC_USERNAME}
postgres: !postgres
database: ${POSTGRES_DATABASE}
host: ${POSTRES_HOST}
host: ${POSTGRES_HOST}
password: ${POSTGRES_PASSWORD}
port: 5432
port: ${POSTGRES_PORT}
schema: example
sql: null
username: ${POSTGRES_USERNAME}
time_zone: America/New_York
4 changes: 0 additions & 4 deletions local/epic.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions local/notifier.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions local/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
!example
as_of: 2019-09-18 17:19:23.873398+00
gold: ./predict/gold/gold.pkl
flowsheets: !flowsheets
client_id: ${EPIC_CLIENT_ID}
cookie: ${EPIC_COOKIE}
flowsheet_id: ${EPIC_FLOWSHEET_ID}
flowsheet_template_id: ${EPIC_FLOWSHEET_TEMPLATE_ID}
password: ${EPIC_PASSWORD}
url: ${EPIC_URL}api/epic/2011/clinical/patient/addflowsheetvalue/flowsheetvalue
username: ${EPIC_USERNAME}
postgres: !postgres
database: ${POSTGRES_DATABASE}
host: ${POSTGRES_HOST}
password: ${POSTGRES_PASSWORD}
port: ${POSTGRES_PORT}
schema: example
sql: null
username: ${POSTGRES_USERNAME}
time_zone: America/New_York
18 changes: 0 additions & 18 deletions local/verifier.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion secrets/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*
!.gitignore
!docker.env
!example.env
16 changes: 0 additions & 16 deletions secrets/docker.env

This file was deleted.

13 changes: 13 additions & 0 deletions secrets/example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
EPIC_CLIENT_ID=00000000-0000-0000-0000-000000000000
EPIC_COOKIE=ASP.NET_SessionId=000000000000000000000000
EPIC_FLOWSHEET_ID=0000000000
EPIC_FLOWSHEET_TEMPLATE_ID=0000000000
EPIC_PASSWORD=password
EPIC_URL=https://interconnectbgprod.uphs.upenn.edu/interconnect-prd-web/
EPIC_USERNAME=epic
EPIC_USER_ID=PENNSIGNALS
POSTGRES_DATABASE=test
POSTGRES_HOST=postgres
POSTGRES_PASSWORD=password
POSTGRES_PORT=5432
POSTGRES_USERNAME=postgres
10 changes: 1 addition & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,10 @@
"types-pymssql",
"types-pyyaml",
"types-requests",
"vcrpy",
)

setup(
entry_points={
"console_scripts": [
"epic = dsdk.epic:Server.main"
"epic.notify = dsdk.epic:Notifier.main",
"epic.verify = dsdk.epic:Verifier.main",
"epic.notify.api.test = dsdk.epic:Notifier.test",
"epic.verify.api.test = dsdk.epic:Verifier.test",
]
},
extras_require={
"all": (PSYCOPG2_REQUIRES + PYMSSQL_REQUIRES + TEST_REQUIRES),
"psycopg2": PSYCOPG2_REQUIRES,
Expand Down
4 changes: 4 additions & 0 deletions src/dsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"""Data Science Deployment Kit."""

from .asset import Asset
from .flowsheet import Mixin as FlowsheetMixin
from .flowsheet import Flowsheet
from .interval import Interval
from .model import Mixin as ModelMixin
from .model import Model
Expand All @@ -28,6 +30,8 @@
"Batch",
"Delegate",
"Interval",
"Flowsheet",
"FlowsheetMixin",
"Model",
"ModelMixin",
"MssqlMixin",
Expand Down
Loading

0 comments on commit 80f7a25

Please sign in to comment.