diff --git a/.github/workflows/pre-commit-autoupdate.yaml b/.github/workflows/pre-commit-autoupdate.yaml new file mode 100644 index 0000000..4d1e42f --- /dev/null +++ b/.github/workflows/pre-commit-autoupdate.yaml @@ -0,0 +1,26 @@ +name: Pre-commit auto-update + +on: + # every day at midnight + schedule: + - cron: "0 0 * * *" + # on demand + workflow_dispatch: + +jobs: + auto-update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + + - uses: browniebroke/pre-commit-autoupdate-action@main + + - uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: update/pre-commit-hooks + title: Update pre-commit hooks + commit-message: "chore: update pre-commit hooks" + body: Update versions of pre-commit hooks to latest version. diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000..ec4d9b3 --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,14 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e8fb4f1..e87cb82 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,6 +6,10 @@ on: - main - develop +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: get-python-versions: runs-on: ubuntu-latest @@ -15,12 +19,14 @@ jobs: - uses: snok/latest-python-versions@v1 id: get-python-versions-action with: - min-version: 3.7 + min-version: 3.8 test: + permissions: write-all needs: [get-python-versions] runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python-version: ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }} @@ -50,7 +56,16 @@ jobs: run: poetry install --with test --no-interaction - name: Run tests - run: poetry run pytest --cov + run: | + poetry run pytest \ + --junitxml=pytest.xml \ + --cov-report=term-missing:skip-covered \ + --cov=welkin test/ | tee pytest-coverage.txt - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + continue-on-error: true + with: + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./pytest.xml + unique-id-for-comment: ${{ matrix.python-version }} diff --git a/.gitignore b/.gitignore index e61a850..5a4ec39 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,8 @@ coverage.xml *.py,cover .hypothesis/ .pytest_cache/ +pytest-coverage.txt +pytest.xml # Translations *.mo diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..db8f572 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + args: [--unsafe] + - id: debug-statements + - id: mixed-line-ending + + ## Python + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + types: [python] + + - repo: https://github.com/psf/black + rev: 23.9.1 + hooks: + - id: black + types: [python] diff --git a/.vscode/settings.json b/.vscode/settings.json index 7b7d07a..4b80975 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "[python]": { "editor.codeActionsOnSave": { - "source.organizeImports": true + "source.organizeImports": "explicit" } }, "editor.formatOnSave": true, diff --git a/poetry.lock b/poetry.lock index 58e0745..e96793c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -36,7 +36,6 @@ files = [ [package.dependencies] lazy-object-proxy = ">=1.4.0" setuptools = ">=20.0" -typed-ast = {version = ">=1.4.0,<2.0", markers = "implementation_name == \"cpython\" and python_version < \"3.8\""} typing-extensions = {version = ">=3.10", markers = "python_version < \"3.10\""} wrapt = ">=1.11,<2" @@ -81,7 +80,6 @@ mypy-extensions = ">=0.4.3" pathspec = ">=0.9.0" platformdirs = ">=2" tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} -typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\" and implementation_name == \"cpython\""} typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} [package.extras] @@ -101,6 +99,17 @@ files = [ {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, ] +[[package]] +name = "cfgv" +version = "3.4.0" +description = "Validate configuration and produce human readable error messages." +optional = false +python-versions = ">=3.8" +files = [ + {file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"}, + {file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"}, +] + [[package]] name = "charset-normalizer" version = "3.2.0" @@ -198,7 +207,6 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [[package]] name = "colorama" @@ -286,6 +294,17 @@ tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.1 [package.extras] toml = ["tomli"] +[[package]] +name = "distlib" +version = "0.3.7" +description = "Distribution utilities" +optional = false +python-versions = "*" +files = [ + {file = "distlib-0.3.7-py2.py3-none-any.whl", hash = "sha256:2e24928bc811348f0feb63014e97aaae3037f2cf48712d51ae61df7fd6075057"}, + {file = "distlib-0.3.7.tar.gz", hash = "sha256:9dafe54b34a028eafd95039d5e5d4851a13734540f1331060d31c9916e7147a8"}, +] + [[package]] name = "docutils" version = "0.18.1" @@ -325,6 +344,36 @@ files = [ [package.extras] testing = ["hatch", "pre-commit", "pytest", "tox"] +[[package]] +name = "filelock" +version = "3.13.1" +description = "A platform independent file lock." +optional = false +python-versions = ">=3.8" +files = [ + {file = "filelock-3.13.1-py3-none-any.whl", hash = "sha256:57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c"}, + {file = "filelock-3.13.1.tar.gz", hash = "sha256:521f5f56c50f8426f5e03ad3b281b490a87ef15bc6c526f168290f0c7148d44e"}, +] + +[package.extras] +docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.24)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"] +typing = ["typing-extensions (>=4.8)"] + +[[package]] +name = "identify" +version = "2.5.31" +description = "File identification library for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "identify-2.5.31-py2.py3-none-any.whl", hash = "sha256:90199cb9e7bd3c5407a9b7e81b4abec4bb9d249991c79439ec8af740afc6293d"}, + {file = "identify-2.5.31.tar.gz", hash = "sha256:7736b3c7a28233637e3c36550646fc6389bedd74ae84cb788200cc8e2dd60b75"}, +] + +[package.extras] +license = ["ukkonen"] + [[package]] name = "idna" version = "3.4" @@ -359,7 +408,6 @@ files = [ ] [package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} zipp = ">=0.5" [package.extras] @@ -481,7 +529,6 @@ files = [ [package.dependencies] mdurl = ">=0.1,<1.0" -typing_extensions = {version = ">=3.7.4", markers = "python_version < \"3.8\""} [package.extras] benchmarking = ["psutil", "pytest", "pytest-benchmark"] @@ -702,6 +749,20 @@ linkify = ["linkify-it-py (>=1.0,<2.0)"] rtd = ["ipython", "sphinx-book-theme", "sphinx-design", "sphinxcontrib.mermaid (>=0.7.1,<0.8.0)", "sphinxext-opengraph (>=0.6.3,<0.7.0)", "sphinxext-rediraffe (>=0.2.7,<0.3.0)"] testing = ["beautifulsoup4", "coverage[toml]", "pytest (>=6,<7)", "pytest-cov", "pytest-param-files (>=0.3.4,<0.4.0)", "pytest-regressions", "sphinx (<5.2)", "sphinx-pytest"] +[[package]] +name = "nodeenv" +version = "1.8.0" +description = "Node.js virtual environment builder" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" +files = [ + {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, + {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"}, +] + +[package.dependencies] +setuptools = "*" + [[package]] name = "packaging" version = "23.1" @@ -735,9 +796,6 @@ files = [ {file = "platformdirs-3.10.0.tar.gz", hash = "sha256:b45696dab2d7cc691a3226759c0d3b00c47c8b6e293d96f6436f733303f77f6d"}, ] -[package.dependencies] -typing-extensions = {version = ">=4.7.1", markers = "python_version < \"3.8\""} - [package.extras] docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"] @@ -753,9 +811,6 @@ files = [ {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, ] -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] @@ -779,6 +834,24 @@ docs = ["sphinx (>=1.7.1)"] redis = ["redis"] tests = ["pytest (>=5.4.1)", "pytest-cov (>=2.8.1)", "pytest-mypy (>=0.8.0)", "pytest-timeout (>=2.1.0)", "redis", "sphinx (>=6.0.0)"] +[[package]] +name = "pre-commit" +version = "3.5.0" +description = "A framework for managing and maintaining multi-language pre-commit hooks." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pre_commit-3.5.0-py2.py3-none-any.whl", hash = "sha256:841dc9aef25daba9a0238cd27984041fa0467b4199fc4852e27950664919f660"}, + {file = "pre_commit-3.5.0.tar.gz", hash = "sha256:5804465c675b659b0862f07907f96295d490822a450c4c40e747d0b1c6ebcb32"}, +] + +[package.dependencies] +cfgv = ">=2.0.0" +identify = ">=1.0.0" +nodeenv = ">=0.11.1" +pyyaml = ">=5.1" +virtualenv = ">=20.10.0" + [[package]] name = "pygments" version = "2.16.1" @@ -807,7 +880,6 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" @@ -1231,56 +1303,6 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "typed-ast" -version = "1.5.5" -description = "a fork of Python 2 and 3 ast modules with type comment support" -optional = false -python-versions = ">=3.6" -files = [ - {file = "typed_ast-1.5.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4bc1efe0ce3ffb74784e06460f01a223ac1f6ab31c6bc0376a21184bf5aabe3b"}, - {file = "typed_ast-1.5.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5f7a8c46a8b333f71abd61d7ab9255440d4a588f34a21f126bbfc95f6049e686"}, - {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:597fc66b4162f959ee6a96b978c0435bd63791e31e4f410622d19f1686d5e769"}, - {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d41b7a686ce653e06c2609075d397ebd5b969d821b9797d029fccd71fdec8e04"}, - {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:5fe83a9a44c4ce67c796a1b466c270c1272e176603d5e06f6afbc101a572859d"}, - {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d5c0c112a74c0e5db2c75882a0adf3133adedcdbfd8cf7c9d6ed77365ab90a1d"}, - {file = "typed_ast-1.5.5-cp310-cp310-win_amd64.whl", hash = "sha256:e1a976ed4cc2d71bb073e1b2a250892a6e968ff02aa14c1f40eba4f365ffec02"}, - {file = "typed_ast-1.5.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c631da9710271cb67b08bd3f3813b7af7f4c69c319b75475436fcab8c3d21bee"}, - {file = "typed_ast-1.5.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b445c2abfecab89a932b20bd8261488d574591173d07827c1eda32c457358b18"}, - {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cc95ffaaab2be3b25eb938779e43f513e0e538a84dd14a5d844b8f2932593d88"}, - {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61443214d9b4c660dcf4b5307f15c12cb30bdfe9588ce6158f4a005baeb167b2"}, - {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6eb936d107e4d474940469e8ec5b380c9b329b5f08b78282d46baeebd3692dc9"}, - {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e48bf27022897577d8479eaed64701ecaf0467182448bd95759883300ca818c8"}, - {file = "typed_ast-1.5.5-cp311-cp311-win_amd64.whl", hash = "sha256:83509f9324011c9a39faaef0922c6f720f9623afe3fe220b6d0b15638247206b"}, - {file = "typed_ast-1.5.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:44f214394fc1af23ca6d4e9e744804d890045d1643dd7e8229951e0ef39429b5"}, - {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:118c1ce46ce58fda78503eae14b7664163aa735b620b64b5b725453696f2a35c"}, - {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be4919b808efa61101456e87f2d4c75b228f4e52618621c77f1ddcaae15904fa"}, - {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:fc2b8c4e1bc5cd96c1a823a885e6b158f8451cf6f5530e1829390b4d27d0807f"}, - {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:16f7313e0a08c7de57f2998c85e2a69a642e97cb32f87eb65fbfe88381a5e44d"}, - {file = "typed_ast-1.5.5-cp36-cp36m-win_amd64.whl", hash = "sha256:2b946ef8c04f77230489f75b4b5a4a6f24c078be4aed241cfabe9cbf4156e7e5"}, - {file = "typed_ast-1.5.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2188bc33d85951ea4ddad55d2b35598b2709d122c11c75cffd529fbc9965508e"}, - {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0635900d16ae133cab3b26c607586131269f88266954eb04ec31535c9a12ef1e"}, - {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:57bfc3cf35a0f2fdf0a88a3044aafaec1d2f24d8ae8cd87c4f58d615fb5b6311"}, - {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:fe58ef6a764de7b4b36edfc8592641f56e69b7163bba9f9c8089838ee596bfb2"}, - {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d09d930c2d1d621f717bb217bf1fe2584616febb5138d9b3e8cdd26506c3f6d4"}, - {file = "typed_ast-1.5.5-cp37-cp37m-win_amd64.whl", hash = "sha256:d40c10326893ecab8a80a53039164a224984339b2c32a6baf55ecbd5b1df6431"}, - {file = "typed_ast-1.5.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fd946abf3c31fb50eee07451a6aedbfff912fcd13cf357363f5b4e834cc5e71a"}, - {file = "typed_ast-1.5.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ed4a1a42df8a3dfb6b40c3d2de109e935949f2f66b19703eafade03173f8f437"}, - {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:045f9930a1550d9352464e5149710d56a2aed23a2ffe78946478f7b5416f1ede"}, - {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:381eed9c95484ceef5ced626355fdc0765ab51d8553fec08661dce654a935db4"}, - {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:bfd39a41c0ef6f31684daff53befddae608f9daf6957140228a08e51f312d7e6"}, - {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8c524eb3024edcc04e288db9541fe1f438f82d281e591c548903d5b77ad1ddd4"}, - {file = "typed_ast-1.5.5-cp38-cp38-win_amd64.whl", hash = "sha256:7f58fabdde8dcbe764cef5e1a7fcb440f2463c1bbbec1cf2a86ca7bc1f95184b"}, - {file = "typed_ast-1.5.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:042eb665ff6bf020dd2243307d11ed626306b82812aba21836096d229fdc6a10"}, - {file = "typed_ast-1.5.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:622e4a006472b05cf6ef7f9f2636edc51bda670b7bbffa18d26b255269d3d814"}, - {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1efebbbf4604ad1283e963e8915daa240cb4bf5067053cf2f0baadc4d4fb51b8"}, - {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0aefdd66f1784c58f65b502b6cf8b121544680456d1cebbd300c2c813899274"}, - {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:48074261a842acf825af1968cd912f6f21357316080ebaca5f19abbb11690c8a"}, - {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:429ae404f69dc94b9361bb62291885894b7c6fb4640d561179548c849f8492ba"}, - {file = "typed_ast-1.5.5-cp39-cp39-win_amd64.whl", hash = "sha256:335f22ccb244da2b5c296e6f96b06ee9bed46526db0de38d2f0e5a6597b81155"}, - {file = "typed_ast-1.5.5.tar.gz", hash = "sha256:94282f7a354f36ef5dbce0ef3467ebf6a258e370ab33d5b40c249fa996e590dd"}, -] - [[package]] name = "typing-extensions" version = "4.7.1" @@ -1326,6 +1348,26 @@ urllib3 = {version = "<2", markers = "python_version < \"3.10\""} wrapt = "*" yarl = "*" +[[package]] +name = "virtualenv" +version = "20.24.6" +description = "Virtual Python Environment builder" +optional = false +python-versions = ">=3.7" +files = [ + {file = "virtualenv-20.24.6-py3-none-any.whl", hash = "sha256:520d056652454c5098a00c0f073611ccbea4c79089331f60bf9d7ba247bb7381"}, + {file = "virtualenv-20.24.6.tar.gz", hash = "sha256:02ece4f56fbf939dbbc33c0715159951d6bf14aaf5457b092e4548e1382455af"}, +] + +[package.dependencies] +distlib = ">=0.3.7,<1" +filelock = ">=3.12.2,<4" +platformdirs = ">=3.9.1,<4" + +[package.extras] +docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] + [[package]] name = "wrapt" version = "1.15.0" @@ -1496,7 +1538,6 @@ files = [ [package.dependencies] idna = ">=2.0" multidict = ">=4.0" -typing-extensions = {version = ">=3.7.4", markers = "python_version < \"3.8\""} [[package]] name = "zipp" @@ -1515,5 +1556,5 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" -python-versions = "^3.7" -content-hash = "e29038a3548768e3be7cc1bce96c0170325667dff52ebf2126f63536fbd82e0f" +python-versions = "^3.8" +content-hash = "c28aa3ec9916edecdc6d57e58cd1b6e3539d952a9c2f038cefa264bf1b6139b9" diff --git a/pyproject.toml b/pyproject.toml index 909700d..40f173b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ classifiers = [ "Bug Tracker" = "https://github.com/lightmatter/welkin-health/issues" [tool.poetry.dependencies] -python = "^3.7" +python = "^3.8" requests = "^2.28.1" portalocker = "^2.7.0" inflection = "^0.5.1" @@ -28,6 +28,7 @@ optional = true [tool.poetry.group.dev.dependencies] black = "^22.10.0" isort = "^5.10.1" +pre-commit = "^3.5.0" [tool.poetry.group.test] optional = true @@ -57,6 +58,9 @@ build-backend = "poetry.core.masonry.api" [tool.isort] profile = "black" +[tool.coverage.run] +omit = ["test/*"] + [tool.pytest.ini_options] addopts = ["-n=auto"] env_files = [".env", ".env.example"] diff --git a/test/cassettes/TestFormation.test_program_read.yaml b/test/cassettes/TestFormation.test_program_read.yaml new file mode 100644 index 0000000..5e19883 --- /dev/null +++ b/test/cassettes/TestFormation.test_program_read.yaml @@ -0,0 +1,67 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_0c8270ba-29f2-44f3-b5cc-a804f4d9840f + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/formations/current/programs/prog-non-target-patient + response: + body: + string: '{"name": "prog-non-target-patient", "title": "Non-Target Patient", + "description": "All other non-target patients that do not meet the criteria + for other care plans.", "phases": [{"name": "start", "title": "Start", "type": + "START", "description": "", "autoFinishProgram": false, "navigateTo": [{"name": + "finish"}]}, {"name": "finish", "title": "Finish", "type": "FINISH", "description": + "", "autoFinishProgram": false, "navigateTo": []}], "nodes": [{"id": "start", + "data": {"label": "Start"}, "type": "graphNode", "position": {"x": 20, "y": + 20}}, {"id": "finish", "data": {"label": "Finish"}, "type": "graphNode", "position": + {"x": 1520, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_34f0e25d-bb67-4d65-9dd2-b7bca6e1bd73-finishHandleTargetLeft_4c1007b4-98fa-45fc-b64b-678f7fbc880a", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 05 Oct 2023 00:06:21 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '914' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/TestFormation.test_programs_read.yaml b/test/cassettes/TestFormation.test_programs_read.yaml new file mode 100644 index 0000000..dc0b7e5 --- /dev/null +++ b/test/cassettes/TestFormation.test_programs_read.yaml @@ -0,0 +1,89 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_5c7de3d2-1fe1-4a28-9a14-c1fe9fd0be66 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/formations/current/programs?page=0 + response: + body: + string: '[{"name": "prog-target-patient", "title": "Target Patient", "description": + "Moderate to severe patients, either on biologics or oral treatment.", "phases": + [{"name": "start", "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}]}, {"name": "finish", "title": "Finish", + "type": "FINISH", "description": "", "autoFinishProgram": false, "navigateTo": + []}], "nodes": [{"id": "start", "data": {"type": "START", "label": "Start"}, + "type": "graphNode", "position": {"x": 340, "y": 20}}, {"id": "finish", "data": + {"type": "FINISH", "label": "Finish"}, "type": "graphNode", "position": {"x": + 680, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_025adb09-c24a-45f9-b5a5-d1a44450ff43-finishHandleTargetLeft_5f5f5e64-5959-46b2-8e36-c85a86e60456", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-target-2-patient", "title": + "Target 2 Patient", "description": "Delayers - en route to top of treatment.", + "phases": [{"name": "start", "title": "Start", "type": "START", "description": + "", "autoFinishProgram": false, "navigateTo": [{"name": "finish"}]}, {"name": + "finish", "title": "Finish", "type": "FINISH", "description": "", "autoFinishProgram": + false, "navigateTo": []}], "nodes": [{"id": "start", "data": {"label": "Start"}, + "type": "graphNode", "position": {"x": 20, "y": 20}}, {"id": "finish", "data": + {"type": "FINISH", "label": "Finish"}, "type": "graphNode", "position": {"x": + 300, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_713b0fea-09cb-4c09-98da-bcb71c6cc9e5-finishHandleTargetLeft_d0fe8672-eafd-4b25-98b8-8845e89953a8", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-non-target-patient", "title": + "Non-Target Patient", "description": "All other non-target patients that do + not meet the criteria for other care plans.", "phases": [{"name": "start", + "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}]}, {"name": "finish", "title": "Finish", + "type": "FINISH", "description": "", "autoFinishProgram": false, "navigateTo": + []}], "nodes": [{"id": "start", "data": {"label": "Start"}, "type": "graphNode", + "position": {"x": 20, "y": 20}}, {"id": "finish", "data": {"label": "Finish"}, + "type": "graphNode", "position": {"x": 1520, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_34f0e25d-bb67-4d65-9dd2-b7bca6e1bd73-finishHandleTargetLeft_4c1007b4-98fa-45fc-b64b-678f7fbc880a", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}]' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 05 Oct 2023 00:05:14 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '2725' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/TestProgram.test_delete.yaml b/test/cassettes/TestProgram.test_delete.yaml new file mode 100644 index 0000000..e6e375c --- /dev/null +++ b/test/cassettes/TestProgram.test_delete.yaml @@ -0,0 +1,311 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_cdbf8879-481a-4cdd-af08-c5a0fc54f3b1 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/formations/current/programs?page=0 + response: + body: + string: '[{"name": "prog-target-patient", "title": "Target Patient", "description": + "Moderate to severe patients, either on biologics or oral treatment.", "phases": + [{"name": "start", "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}, {"name": "continuing-old-treatment"}, + {"name": "stopping-old-treatment"}, {"name": "consent-requested"}]}, {"name": + "finish", "title": "Finish", "type": "FINISH", "description": "", "autoFinishProgram": + false, "navigateTo": []}, {"name": "records-requested", "title": "Records + Requested", "type": "DEFAULT", "description": "", "autoFinishProgram": false, + "navigateTo": [{"name": "records-received"}]}, {"name": "records-received", + "title": "Records Received", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": []}, {"name": "starting-new-treatment", "title": "Starting + New Treatment", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "prior-auth-requested"}, {"name": "sent-to-pharmacy"}]}, + {"name": "continuing-old-treatment", "title": "Continuing Old Treatment", + "type": "DEFAULT", "description": "", "autoFinishProgram": false, "navigateTo": + [{"name": "prior-auth-requested"}, {"name": "sent-to-pharmacy"}]}, {"name": + "prior-auth-requested", "title": "Prior Auth Requested", "type": "DEFAULT", + "description": "", "autoFinishProgram": false, "navigateTo": [{"name": "prior-auth-approved"}, + {"name": "prior-auth-abandoned"}]}, {"name": "prior-auth-approved", "title": + "Prior Auth Approved", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "sent-to-pharmacy"}]}, {"name": "prior-auth-abandoned", + "title": "Prior Auth Abandoned", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "prior-auth-approved"}]}, {"name": "sent-to-pharmacy", + "title": "Sent to Pharmacy", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "confirmed-patient-filled"}]}, {"name": "confirmed-patient-filled", + "title": "Confirmed Patient Filled", "type": "DEFAULT", "description": "", + "autoFinishProgram": false, "navigateTo": []}, {"name": "stopping-old-treatment", + "title": "Stopping Old Treatment", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "starting-new-treatment"}]}, {"name": "consent-requested", + "title": "Consent Requested", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "consent-received"}]}, {"name": "consent-received", + "title": "Consent Received", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "records-requested"}]}], "nodes": [{"id": "start", + "data": {"type": "START", "label": "Start"}, "type": "graphNode", "position": + {"x": 340, "y": 20}}, {"id": "finish", "data": {"type": "FINISH", "label": + "Finish"}, "type": "graphNode", "position": {"x": 1120, "y": 20}}, {"id": + "reactflow__edge-startHandleSrcRight_025adb09-c24a-45f9-b5a5-d1a44450ff43-finishHandleTargetLeft_5f5f5e64-5959-46b2-8e36-c85a86e60456", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}, {"id": "records-requested", "data": {"type": + "DEFAULT", "label": "Records Requested"}, "type": "graphNode", "position": + {"x": 800, "y": -40}}, {"id": "records-received", "data": {"type": "DEFAULT", + "label": "Records Received"}, "type": "graphNode", "position": {"x": 980, + "y": -40}}, {"id": "starting-new-treatment", "data": {"type": "DEFAULT", "label": + "Starting New Treatment"}, "type": "graphNode", "position": {"x": 640, "y": + 80}}, {"id": "continuing-old-treatment", "data": {"type": "DEFAULT", "label": + "Continuing Old Treatment"}, "type": "graphNode", "position": {"x": 440, "y": + 140}}, {"id": "prior-auth-requested", "data": {"type": "DEFAULT", "label": + "Prior Auth Requested"}, "type": "graphNode", "position": {"x": 660, "y": + 160}}, {"id": "prior-auth-approved", "data": {"type": "DEFAULT", "label": + "Prior Auth Approved"}, "type": "graphNode", "position": {"x": 840, "y": 160}}, + {"id": "prior-auth-abandoned", "data": {"type": "DEFAULT", "label": "Prior + Auth Abandoned"}, "type": "graphNode", "position": {"x": 760, "y": 220}}, + {"id": "sent-to-pharmacy", "data": {"type": "DEFAULT", "label": "Sent to Pharmacy"}, + "type": "graphNode", "position": {"x": 860, "y": 80}}, {"id": "confirmed-patient-filled", + "data": {"type": "DEFAULT", "label": "Confirmed Patient Filled"}, "type": + "graphNode", "position": {"x": 1020, "y": 80}}, {"id": "reactflow__edge-records-requestedHandleSrcRight_6672da4b-34f4-42fb-81b3-5d7e785c5e1d-records-receivedHandleTargetLeft_1c3c44da-11c5-4da6-9e79-94f1eb86a5c5", + "type": "smoothstep", "source": "records-requested", "target": "records-received", + "animated": true, "sourceHandle": "HandleSrcRight_records-requested", "targetHandle": + "HandleTargetLeft_records-received", "arrowHeadType": "arrowclosed"}, {"id": + "stopping-old-treatment", "data": {"type": "DEFAULT", "label": "Stopping Old + Treatment"}, "type": "graphNode", "position": {"x": 440, "y": 80}}, {"id": + "reactflow__edge-stopping-old-treatmentHandleSrcRight_26bbcfc7-e81d-48ac-88aa-7bdcb209dc36-starting-new-treatmentHandleTargetLeft_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6", + "type": "smoothstep", "source": "stopping-old-treatment", "target": "starting-new-treatment", + "animated": true, "sourceHandle": "HandleSrcRight_stopping-old-treatment", + "targetHandle": "HandleTargetLeft_starting-new-treatment", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-starting-new-treatmentHandleSrcBottom_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6-prior-auth-requestedHandleTargetTop_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10", + "type": "smoothstep", "source": "starting-new-treatment", "target": "prior-auth-requested", + "animated": true, "sourceHandle": "HandleSrcBottom_starting-new-treatment", + "targetHandle": "HandleTargetTop_prior-auth-requested", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-continuing-old-treatmentHandleSrcRight_40cd6e6c-c21c-45bf-b94c-62092b2b2510-prior-auth-requestedHandleTargetLeft_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10", + "type": "smoothstep", "source": "continuing-old-treatment", "target": "prior-auth-requested", + "animated": true, "sourceHandle": "HandleSrcRight_continuing-old-treatment", + "targetHandle": "HandleTargetLeft_prior-auth-requested", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-prior-auth-requestedHandleSrcRight_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10-prior-auth-approvedHandleTargetLeft_7d04e809-9419-4673-800b-ea2c3d7c04aa", + "type": "smoothstep", "source": "prior-auth-requested", "target": "prior-auth-approved", + "animated": true, "sourceHandle": "HandleSrcRight_prior-auth-requested", "targetHandle": + "HandleTargetLeft_prior-auth-approved", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-sent-to-pharmacyHandleSrcRight_e1ad3528-270a-45bf-9757-91fe3ecb9d23-confirmed-patient-filledHandleTargetLeft_2505253d-32d6-4020-8e16-722b4813a5a7", + "type": "smoothstep", "source": "sent-to-pharmacy", "target": "confirmed-patient-filled", + "animated": true, "sourceHandle": "HandleSrcRight_sent-to-pharmacy", "targetHandle": + "HandleTargetLeft_confirmed-patient-filled", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-starting-new-treatmentHandleSrcRight_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6-sent-to-pharmacyHandleTargetLeft_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "starting-new-treatment", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcRight_starting-new-treatment", + "targetHandle": "HandleTargetLeft_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-prior-auth-requestedHandleSrcBottom_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10-prior-auth-abandonedHandleTargetLeft_982c7e02-2cce-4202-b72c-bee08f44e11a", + "type": "smoothstep", "source": "prior-auth-requested", "target": "prior-auth-abandoned", + "animated": true, "sourceHandle": "HandleSrcBottom_prior-auth-requested", + "targetHandle": "HandleTargetLeft_prior-auth-abandoned", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-prior-auth-abandonedHandleSrcTop_982c7e02-2cce-4202-b72c-bee08f44e11a-prior-auth-approvedHandleTargetBottom_7d04e809-9419-4673-800b-ea2c3d7c04aa", + "type": "smoothstep", "source": "prior-auth-abandoned", "target": "prior-auth-approved", + "animated": true, "sourceHandle": "HandleSrcTop_prior-auth-abandoned", "targetHandle": + "HandleTargetBottom_prior-auth-approved", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-continuing-old-treatmentHandleSrcTop_40cd6e6c-c21c-45bf-b94c-62092b2b2510-sent-to-pharmacyHandleTargetBottom_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "continuing-old-treatment", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcTop_continuing-old-treatment", + "targetHandle": "HandleTargetBottom_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-startHandleSrcBottom_a8a336be-e2ef-4336-bb18-0dfa4b5b9727-stopping-old-treatmentHandleTargetLeft_26bbcfc7-e81d-48ac-88aa-7bdcb209dc36", + "type": "smoothstep", "source": "start", "target": "stopping-old-treatment", + "animated": true, "sourceHandle": "HandleSrcBottom_start", "targetHandle": + "HandleTargetLeft_stopping-old-treatment", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-startHandleSrcBottom_a8a336be-e2ef-4336-bb18-0dfa4b5b9727-continuing-old-treatmentHandleTargetLeft_40cd6e6c-c21c-45bf-b94c-62092b2b2510", + "type": "smoothstep", "source": "start", "target": "continuing-old-treatment", + "animated": true, "sourceHandle": "HandleSrcBottom_start", "targetHandle": + "HandleTargetLeft_continuing-old-treatment", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-prior-auth-approvedHandleSrcTop_7d04e809-9419-4673-800b-ea2c3d7c04aa-sent-to-pharmacyHandleTargetBottom_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "prior-auth-approved", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcTop_prior-auth-approved", "targetHandle": + "HandleTargetBottom_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, {"id": + "consent-requested", "data": {"type": "DEFAULT", "label": "Consent Requested"}, + "type": "graphNode", "position": {"x": 460, "y": -40}}, {"id": "consent-received", + "data": {"type": "DEFAULT", "label": "Consent Received"}, "type": "graphNode", + "position": {"x": 640, "y": -40}}, {"id": "reactflow__edge-consent-receivedHandleSrcRight_2e7445fb-8611-43bd-b750-af720c1530c1-records-requestedHandleTargetLeft_99edae56-fbb6-4bd5-95d0-a02e8b53c097", + "type": "smoothstep", "source": "consent-received", "target": "records-requested", + "animated": true, "sourceHandle": "HandleSrcRight_consent-received", "targetHandle": + "HandleTargetLeft_records-requested", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-consent-requestedHandleSrcRight_b56feb59-d9ad-46e7-8741-a20ad73112b7-consent-receivedHandleTargetLeft_2e7445fb-8611-43bd-b750-af720c1530c1", + "type": "smoothstep", "source": "consent-requested", "target": "consent-received", + "animated": true, "sourceHandle": "HandleSrcRight_consent-requested", "targetHandle": + "HandleTargetLeft_consent-received", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-startHandleSrcTop_712c1b68-4ccd-4f94-8641-5721b6148ed8-consent-requestedHandleTargetLeft_b56feb59-d9ad-46e7-8741-a20ad73112b7", + "type": "smoothstep", "source": "start", "target": "consent-requested", "animated": + true, "sourceHandle": "HandleSrcTop_start", "targetHandle": "HandleTargetLeft_consent-requested", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-target-2-patient", "title": + "Target 2 Patient", "description": "Delayers - en route to top of treatment.", + "phases": [{"name": "start", "title": "Start", "type": "START", "description": + "", "autoFinishProgram": false, "navigateTo": [{"name": "finish"}]}, {"name": + "finish", "title": "Finish", "type": "FINISH", "description": "", "autoFinishProgram": + false, "navigateTo": []}], "nodes": [{"id": "start", "data": {"label": "Start"}, + "type": "graphNode", "position": {"x": 20, "y": 20}}, {"id": "finish", "data": + {"type": "FINISH", "label": "Finish"}, "type": "graphNode", "position": {"x": + 300, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_713b0fea-09cb-4c09-98da-bcb71c6cc9e5-finishHandleTargetLeft_d0fe8672-eafd-4b25-98b8-8845e89953a8", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-non-target-patient", "title": + "Non-Target Patient", "description": "All other non-target patients that do + not meet the criteria for other care plans.", "phases": [{"name": "start", + "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}]}, {"name": "finish", "title": "Finish", + "type": "FINISH", "description": "", "autoFinishProgram": false, "navigateTo": + []}], "nodes": [{"id": "start", "data": {"label": "Start"}, "type": "graphNode", + "position": {"x": 20, "y": 20}}, {"id": "finish", "data": {"label": "Finish"}, + "type": "graphNode", "position": {"x": 1520, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_34f0e25d-bb67-4d65-9dd2-b7bca6e1bd73-finishHandleTargetLeft_4c1007b4-98fa-45fc-b64b-678f7fbc880a", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}]' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:14 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '12829' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_cdbf8879-481a-4cdd-af08-c5a0fc54f3b1 + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python-welkin/0.1.1 + method: DELETE + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/53e7f5de-67d7-475f-9443-6b4dedf14848 + response: + body: + string: '' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 31 Oct 2023 02:10:15 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_cdbf8879-481a-4cdd-af08-c5a0fc54f3b1 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/history/53e7f5de-67d7-475f-9443-6b4dedf14848 + response: + body: + string: '[{"errorCode": "PATIENT_PROGRAM_NOT_FOUND", "componentType": "PATIENT_PROGRAM", + "message": "Patient related to program doesn''t exist", "details": {"id": + "53e7f5de-67d7-475f-9443-6b4dedf14848", "patientId": "de5e1a93-70b0-4ed4-868f-3854becc383c"}, + "date": "2023-10-31T02:10:15.236Z"}]' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:15 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '271' + status: + code: 404 + message: Not Found +version: 1 diff --git a/test/cassettes/TestProgram.test_read[id].yaml b/test/cassettes/TestProgram.test_read[id].yaml new file mode 100644 index 0000000..a397850 --- /dev/null +++ b/test/cassettes/TestProgram.test_read[id].yaml @@ -0,0 +1,269 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_81ee7581-0f2d-4ad6-a3a2-d81fcd1dd971 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/formations/current/programs?page=0 + response: + body: + string: '[{"name": "prog-target-patient", "title": "Target Patient", "description": + "Moderate to severe patients, either on biologics or oral treatment.", "phases": + [{"name": "start", "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}, {"name": "continuing-old-treatment"}, + {"name": "stopping-old-treatment"}, {"name": "consent-requested"}]}, {"name": + "finish", "title": "Finish", "type": "FINISH", "description": "", "autoFinishProgram": + false, "navigateTo": []}, {"name": "records-requested", "title": "Records + Requested", "type": "DEFAULT", "description": "", "autoFinishProgram": false, + "navigateTo": [{"name": "records-received"}]}, {"name": "records-received", + "title": "Records Received", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": []}, {"name": "starting-new-treatment", "title": "Starting + New Treatment", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "prior-auth-requested"}, {"name": "sent-to-pharmacy"}]}, + {"name": "continuing-old-treatment", "title": "Continuing Old Treatment", + "type": "DEFAULT", "description": "", "autoFinishProgram": false, "navigateTo": + [{"name": "prior-auth-requested"}, {"name": "sent-to-pharmacy"}]}, {"name": + "prior-auth-requested", "title": "Prior Auth Requested", "type": "DEFAULT", + "description": "", "autoFinishProgram": false, "navigateTo": [{"name": "prior-auth-approved"}, + {"name": "prior-auth-abandoned"}]}, {"name": "prior-auth-approved", "title": + "Prior Auth Approved", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "sent-to-pharmacy"}]}, {"name": "prior-auth-abandoned", + "title": "Prior Auth Abandoned", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "prior-auth-approved"}]}, {"name": "sent-to-pharmacy", + "title": "Sent to Pharmacy", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "confirmed-patient-filled"}]}, {"name": "confirmed-patient-filled", + "title": "Confirmed Patient Filled", "type": "DEFAULT", "description": "", + "autoFinishProgram": false, "navigateTo": []}, {"name": "stopping-old-treatment", + "title": "Stopping Old Treatment", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "starting-new-treatment"}]}, {"name": "consent-requested", + "title": "Consent Requested", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "consent-received"}]}, {"name": "consent-received", + "title": "Consent Received", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "records-requested"}]}], "nodes": [{"id": "start", + "data": {"type": "START", "label": "Start"}, "type": "graphNode", "position": + {"x": 340, "y": 20}}, {"id": "finish", "data": {"type": "FINISH", "label": + "Finish"}, "type": "graphNode", "position": {"x": 1120, "y": 20}}, {"id": + "reactflow__edge-startHandleSrcRight_025adb09-c24a-45f9-b5a5-d1a44450ff43-finishHandleTargetLeft_5f5f5e64-5959-46b2-8e36-c85a86e60456", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}, {"id": "records-requested", "data": {"type": + "DEFAULT", "label": "Records Requested"}, "type": "graphNode", "position": + {"x": 800, "y": -40}}, {"id": "records-received", "data": {"type": "DEFAULT", + "label": "Records Received"}, "type": "graphNode", "position": {"x": 980, + "y": -40}}, {"id": "starting-new-treatment", "data": {"type": "DEFAULT", "label": + "Starting New Treatment"}, "type": "graphNode", "position": {"x": 640, "y": + 80}}, {"id": "continuing-old-treatment", "data": {"type": "DEFAULT", "label": + "Continuing Old Treatment"}, "type": "graphNode", "position": {"x": 440, "y": + 140}}, {"id": "prior-auth-requested", "data": {"type": "DEFAULT", "label": + "Prior Auth Requested"}, "type": "graphNode", "position": {"x": 660, "y": + 160}}, {"id": "prior-auth-approved", "data": {"type": "DEFAULT", "label": + "Prior Auth Approved"}, "type": "graphNode", "position": {"x": 840, "y": 160}}, + {"id": "prior-auth-abandoned", "data": {"type": "DEFAULT", "label": "Prior + Auth Abandoned"}, "type": "graphNode", "position": {"x": 760, "y": 220}}, + {"id": "sent-to-pharmacy", "data": {"type": "DEFAULT", "label": "Sent to Pharmacy"}, + "type": "graphNode", "position": {"x": 860, "y": 80}}, {"id": "confirmed-patient-filled", + "data": {"type": "DEFAULT", "label": "Confirmed Patient Filled"}, "type": + "graphNode", "position": {"x": 1020, "y": 80}}, {"id": "reactflow__edge-records-requestedHandleSrcRight_6672da4b-34f4-42fb-81b3-5d7e785c5e1d-records-receivedHandleTargetLeft_1c3c44da-11c5-4da6-9e79-94f1eb86a5c5", + "type": "smoothstep", "source": "records-requested", "target": "records-received", + "animated": true, "sourceHandle": "HandleSrcRight_records-requested", "targetHandle": + "HandleTargetLeft_records-received", "arrowHeadType": "arrowclosed"}, {"id": + "stopping-old-treatment", "data": {"type": "DEFAULT", "label": "Stopping Old + Treatment"}, "type": "graphNode", "position": {"x": 440, "y": 80}}, {"id": + "reactflow__edge-stopping-old-treatmentHandleSrcRight_26bbcfc7-e81d-48ac-88aa-7bdcb209dc36-starting-new-treatmentHandleTargetLeft_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6", + "type": "smoothstep", "source": "stopping-old-treatment", "target": "starting-new-treatment", + "animated": true, "sourceHandle": "HandleSrcRight_stopping-old-treatment", + "targetHandle": "HandleTargetLeft_starting-new-treatment", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-starting-new-treatmentHandleSrcBottom_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6-prior-auth-requestedHandleTargetTop_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10", + "type": "smoothstep", "source": "starting-new-treatment", "target": "prior-auth-requested", + "animated": true, "sourceHandle": "HandleSrcBottom_starting-new-treatment", + "targetHandle": "HandleTargetTop_prior-auth-requested", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-continuing-old-treatmentHandleSrcRight_40cd6e6c-c21c-45bf-b94c-62092b2b2510-prior-auth-requestedHandleTargetLeft_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10", + "type": "smoothstep", "source": "continuing-old-treatment", "target": "prior-auth-requested", + "animated": true, "sourceHandle": "HandleSrcRight_continuing-old-treatment", + "targetHandle": "HandleTargetLeft_prior-auth-requested", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-prior-auth-requestedHandleSrcRight_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10-prior-auth-approvedHandleTargetLeft_7d04e809-9419-4673-800b-ea2c3d7c04aa", + "type": "smoothstep", "source": "prior-auth-requested", "target": "prior-auth-approved", + "animated": true, "sourceHandle": "HandleSrcRight_prior-auth-requested", "targetHandle": + "HandleTargetLeft_prior-auth-approved", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-sent-to-pharmacyHandleSrcRight_e1ad3528-270a-45bf-9757-91fe3ecb9d23-confirmed-patient-filledHandleTargetLeft_2505253d-32d6-4020-8e16-722b4813a5a7", + "type": "smoothstep", "source": "sent-to-pharmacy", "target": "confirmed-patient-filled", + "animated": true, "sourceHandle": "HandleSrcRight_sent-to-pharmacy", "targetHandle": + "HandleTargetLeft_confirmed-patient-filled", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-starting-new-treatmentHandleSrcRight_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6-sent-to-pharmacyHandleTargetLeft_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "starting-new-treatment", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcRight_starting-new-treatment", + "targetHandle": "HandleTargetLeft_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-prior-auth-requestedHandleSrcBottom_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10-prior-auth-abandonedHandleTargetLeft_982c7e02-2cce-4202-b72c-bee08f44e11a", + "type": "smoothstep", "source": "prior-auth-requested", "target": "prior-auth-abandoned", + "animated": true, "sourceHandle": "HandleSrcBottom_prior-auth-requested", + "targetHandle": "HandleTargetLeft_prior-auth-abandoned", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-prior-auth-abandonedHandleSrcTop_982c7e02-2cce-4202-b72c-bee08f44e11a-prior-auth-approvedHandleTargetBottom_7d04e809-9419-4673-800b-ea2c3d7c04aa", + "type": "smoothstep", "source": "prior-auth-abandoned", "target": "prior-auth-approved", + "animated": true, "sourceHandle": "HandleSrcTop_prior-auth-abandoned", "targetHandle": + "HandleTargetBottom_prior-auth-approved", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-continuing-old-treatmentHandleSrcTop_40cd6e6c-c21c-45bf-b94c-62092b2b2510-sent-to-pharmacyHandleTargetBottom_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "continuing-old-treatment", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcTop_continuing-old-treatment", + "targetHandle": "HandleTargetBottom_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-startHandleSrcBottom_a8a336be-e2ef-4336-bb18-0dfa4b5b9727-stopping-old-treatmentHandleTargetLeft_26bbcfc7-e81d-48ac-88aa-7bdcb209dc36", + "type": "smoothstep", "source": "start", "target": "stopping-old-treatment", + "animated": true, "sourceHandle": "HandleSrcBottom_start", "targetHandle": + "HandleTargetLeft_stopping-old-treatment", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-startHandleSrcBottom_a8a336be-e2ef-4336-bb18-0dfa4b5b9727-continuing-old-treatmentHandleTargetLeft_40cd6e6c-c21c-45bf-b94c-62092b2b2510", + "type": "smoothstep", "source": "start", "target": "continuing-old-treatment", + "animated": true, "sourceHandle": "HandleSrcBottom_start", "targetHandle": + "HandleTargetLeft_continuing-old-treatment", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-prior-auth-approvedHandleSrcTop_7d04e809-9419-4673-800b-ea2c3d7c04aa-sent-to-pharmacyHandleTargetBottom_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "prior-auth-approved", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcTop_prior-auth-approved", "targetHandle": + "HandleTargetBottom_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, {"id": + "consent-requested", "data": {"type": "DEFAULT", "label": "Consent Requested"}, + "type": "graphNode", "position": {"x": 460, "y": -40}}, {"id": "consent-received", + "data": {"type": "DEFAULT", "label": "Consent Received"}, "type": "graphNode", + "position": {"x": 640, "y": -40}}, {"id": "reactflow__edge-consent-receivedHandleSrcRight_2e7445fb-8611-43bd-b750-af720c1530c1-records-requestedHandleTargetLeft_99edae56-fbb6-4bd5-95d0-a02e8b53c097", + "type": "smoothstep", "source": "consent-received", "target": "records-requested", + "animated": true, "sourceHandle": "HandleSrcRight_consent-received", "targetHandle": + "HandleTargetLeft_records-requested", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-consent-requestedHandleSrcRight_b56feb59-d9ad-46e7-8741-a20ad73112b7-consent-receivedHandleTargetLeft_2e7445fb-8611-43bd-b750-af720c1530c1", + "type": "smoothstep", "source": "consent-requested", "target": "consent-received", + "animated": true, "sourceHandle": "HandleSrcRight_consent-requested", "targetHandle": + "HandleTargetLeft_consent-received", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-startHandleSrcTop_712c1b68-4ccd-4f94-8641-5721b6148ed8-consent-requestedHandleTargetLeft_b56feb59-d9ad-46e7-8741-a20ad73112b7", + "type": "smoothstep", "source": "start", "target": "consent-requested", "animated": + true, "sourceHandle": "HandleSrcTop_start", "targetHandle": "HandleTargetLeft_consent-requested", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-target-2-patient", "title": + "Target 2 Patient", "description": "Delayers - en route to top of treatment.", + "phases": [{"name": "start", "title": "Start", "type": "START", "description": + "", "autoFinishProgram": false, "navigateTo": [{"name": "finish"}]}, {"name": + "finish", "title": "Finish", "type": "FINISH", "description": "", "autoFinishProgram": + false, "navigateTo": []}], "nodes": [{"id": "start", "data": {"label": "Start"}, + "type": "graphNode", "position": {"x": 20, "y": 20}}, {"id": "finish", "data": + {"type": "FINISH", "label": "Finish"}, "type": "graphNode", "position": {"x": + 300, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_713b0fea-09cb-4c09-98da-bcb71c6cc9e5-finishHandleTargetLeft_d0fe8672-eafd-4b25-98b8-8845e89953a8", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-non-target-patient", "title": + "Non-Target Patient", "description": "All other non-target patients that do + not meet the criteria for other care plans.", "phases": [{"name": "start", + "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}]}, {"name": "finish", "title": "Finish", + "type": "FINISH", "description": "", "autoFinishProgram": false, "navigateTo": + []}], "nodes": [{"id": "start", "data": {"label": "Start"}, "type": "graphNode", + "position": {"x": 20, "y": 20}}, {"id": "finish", "data": {"label": "Finish"}, + "type": "graphNode", "position": {"x": 1520, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_34f0e25d-bb67-4d65-9dd2-b7bca6e1bd73-finishHandleTargetLeft_4c1007b4-98fa-45fc-b64b-678f7fbc880a", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}]' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:14 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '12829' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_81ee7581-0f2d-4ad6-a3a2-d81fcd1dd971 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/history/53e7f5de-67d7-475f-9443-6b4dedf14848 + response: + body: + string: '{"id": "53e7f5de-67d7-475f-9443-6b4dedf14848", "createdByName": "createdByName_REDACTED_d1f0948c-ca42-4732-b455-69627a84d64a", + "createdAt": "2023-10-31T02:05:28.717Z", "updatedByName": "updatedByName_REDACTED_096bd988-c5f3-496f-9e76-2b753de4c6b7", + "updatedAt": "2023-10-31T02:05:28.721Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:05:28.720Z", + "createdBy": "createdBy_REDACTED_d7ea081e-1536-4f22-964d-8ea9d9ff578b", "createdByName": + "createdByName_REDACTED_8509eaf7-95a2-4acb-9f51-fcc6681aad52", "name": "start", + "title": "Start", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:05:28.720Z", "createdBy": "createdBy_REDACTED_597490de-5966-4e40-ad13-bc33bd245d3e", + "createdByName": "createdByName_REDACTED_5730ba9f-d49a-43a8-ac61-8564d03c0ed0", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}]}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:15 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '963' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/TestProgram.test_read[programName].yaml b/test/cassettes/TestProgram.test_read[programName].yaml new file mode 100644 index 0000000..f5bc9eb --- /dev/null +++ b/test/cassettes/TestProgram.test_read[programName].yaml @@ -0,0 +1,269 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_81ee7581-0f2d-4ad6-a3a2-d81fcd1dd971 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/formations/current/programs?page=0 + response: + body: + string: '[{"name": "prog-target-patient", "title": "Target Patient", "description": + "Moderate to severe patients, either on biologics or oral treatment.", "phases": + [{"name": "start", "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}, {"name": "continuing-old-treatment"}, + {"name": "stopping-old-treatment"}, {"name": "consent-requested"}]}, {"name": + "finish", "title": "Finish", "type": "FINISH", "description": "", "autoFinishProgram": + false, "navigateTo": []}, {"name": "records-requested", "title": "Records + Requested", "type": "DEFAULT", "description": "", "autoFinishProgram": false, + "navigateTo": [{"name": "records-received"}]}, {"name": "records-received", + "title": "Records Received", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": []}, {"name": "starting-new-treatment", "title": "Starting + New Treatment", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "prior-auth-requested"}, {"name": "sent-to-pharmacy"}]}, + {"name": "continuing-old-treatment", "title": "Continuing Old Treatment", + "type": "DEFAULT", "description": "", "autoFinishProgram": false, "navigateTo": + [{"name": "prior-auth-requested"}, {"name": "sent-to-pharmacy"}]}, {"name": + "prior-auth-requested", "title": "Prior Auth Requested", "type": "DEFAULT", + "description": "", "autoFinishProgram": false, "navigateTo": [{"name": "prior-auth-approved"}, + {"name": "prior-auth-abandoned"}]}, {"name": "prior-auth-approved", "title": + "Prior Auth Approved", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "sent-to-pharmacy"}]}, {"name": "prior-auth-abandoned", + "title": "Prior Auth Abandoned", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "prior-auth-approved"}]}, {"name": "sent-to-pharmacy", + "title": "Sent to Pharmacy", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "confirmed-patient-filled"}]}, {"name": "confirmed-patient-filled", + "title": "Confirmed Patient Filled", "type": "DEFAULT", "description": "", + "autoFinishProgram": false, "navigateTo": []}, {"name": "stopping-old-treatment", + "title": "Stopping Old Treatment", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "starting-new-treatment"}]}, {"name": "consent-requested", + "title": "Consent Requested", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "consent-received"}]}, {"name": "consent-received", + "title": "Consent Received", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "records-requested"}]}], "nodes": [{"id": "start", + "data": {"type": "START", "label": "Start"}, "type": "graphNode", "position": + {"x": 340, "y": 20}}, {"id": "finish", "data": {"type": "FINISH", "label": + "Finish"}, "type": "graphNode", "position": {"x": 1120, "y": 20}}, {"id": + "reactflow__edge-startHandleSrcRight_025adb09-c24a-45f9-b5a5-d1a44450ff43-finishHandleTargetLeft_5f5f5e64-5959-46b2-8e36-c85a86e60456", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}, {"id": "records-requested", "data": {"type": + "DEFAULT", "label": "Records Requested"}, "type": "graphNode", "position": + {"x": 800, "y": -40}}, {"id": "records-received", "data": {"type": "DEFAULT", + "label": "Records Received"}, "type": "graphNode", "position": {"x": 980, + "y": -40}}, {"id": "starting-new-treatment", "data": {"type": "DEFAULT", "label": + "Starting New Treatment"}, "type": "graphNode", "position": {"x": 640, "y": + 80}}, {"id": "continuing-old-treatment", "data": {"type": "DEFAULT", "label": + "Continuing Old Treatment"}, "type": "graphNode", "position": {"x": 440, "y": + 140}}, {"id": "prior-auth-requested", "data": {"type": "DEFAULT", "label": + "Prior Auth Requested"}, "type": "graphNode", "position": {"x": 660, "y": + 160}}, {"id": "prior-auth-approved", "data": {"type": "DEFAULT", "label": + "Prior Auth Approved"}, "type": "graphNode", "position": {"x": 840, "y": 160}}, + {"id": "prior-auth-abandoned", "data": {"type": "DEFAULT", "label": "Prior + Auth Abandoned"}, "type": "graphNode", "position": {"x": 760, "y": 220}}, + {"id": "sent-to-pharmacy", "data": {"type": "DEFAULT", "label": "Sent to Pharmacy"}, + "type": "graphNode", "position": {"x": 860, "y": 80}}, {"id": "confirmed-patient-filled", + "data": {"type": "DEFAULT", "label": "Confirmed Patient Filled"}, "type": + "graphNode", "position": {"x": 1020, "y": 80}}, {"id": "reactflow__edge-records-requestedHandleSrcRight_6672da4b-34f4-42fb-81b3-5d7e785c5e1d-records-receivedHandleTargetLeft_1c3c44da-11c5-4da6-9e79-94f1eb86a5c5", + "type": "smoothstep", "source": "records-requested", "target": "records-received", + "animated": true, "sourceHandle": "HandleSrcRight_records-requested", "targetHandle": + "HandleTargetLeft_records-received", "arrowHeadType": "arrowclosed"}, {"id": + "stopping-old-treatment", "data": {"type": "DEFAULT", "label": "Stopping Old + Treatment"}, "type": "graphNode", "position": {"x": 440, "y": 80}}, {"id": + "reactflow__edge-stopping-old-treatmentHandleSrcRight_26bbcfc7-e81d-48ac-88aa-7bdcb209dc36-starting-new-treatmentHandleTargetLeft_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6", + "type": "smoothstep", "source": "stopping-old-treatment", "target": "starting-new-treatment", + "animated": true, "sourceHandle": "HandleSrcRight_stopping-old-treatment", + "targetHandle": "HandleTargetLeft_starting-new-treatment", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-starting-new-treatmentHandleSrcBottom_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6-prior-auth-requestedHandleTargetTop_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10", + "type": "smoothstep", "source": "starting-new-treatment", "target": "prior-auth-requested", + "animated": true, "sourceHandle": "HandleSrcBottom_starting-new-treatment", + "targetHandle": "HandleTargetTop_prior-auth-requested", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-continuing-old-treatmentHandleSrcRight_40cd6e6c-c21c-45bf-b94c-62092b2b2510-prior-auth-requestedHandleTargetLeft_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10", + "type": "smoothstep", "source": "continuing-old-treatment", "target": "prior-auth-requested", + "animated": true, "sourceHandle": "HandleSrcRight_continuing-old-treatment", + "targetHandle": "HandleTargetLeft_prior-auth-requested", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-prior-auth-requestedHandleSrcRight_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10-prior-auth-approvedHandleTargetLeft_7d04e809-9419-4673-800b-ea2c3d7c04aa", + "type": "smoothstep", "source": "prior-auth-requested", "target": "prior-auth-approved", + "animated": true, "sourceHandle": "HandleSrcRight_prior-auth-requested", "targetHandle": + "HandleTargetLeft_prior-auth-approved", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-sent-to-pharmacyHandleSrcRight_e1ad3528-270a-45bf-9757-91fe3ecb9d23-confirmed-patient-filledHandleTargetLeft_2505253d-32d6-4020-8e16-722b4813a5a7", + "type": "smoothstep", "source": "sent-to-pharmacy", "target": "confirmed-patient-filled", + "animated": true, "sourceHandle": "HandleSrcRight_sent-to-pharmacy", "targetHandle": + "HandleTargetLeft_confirmed-patient-filled", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-starting-new-treatmentHandleSrcRight_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6-sent-to-pharmacyHandleTargetLeft_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "starting-new-treatment", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcRight_starting-new-treatment", + "targetHandle": "HandleTargetLeft_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-prior-auth-requestedHandleSrcBottom_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10-prior-auth-abandonedHandleTargetLeft_982c7e02-2cce-4202-b72c-bee08f44e11a", + "type": "smoothstep", "source": "prior-auth-requested", "target": "prior-auth-abandoned", + "animated": true, "sourceHandle": "HandleSrcBottom_prior-auth-requested", + "targetHandle": "HandleTargetLeft_prior-auth-abandoned", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-prior-auth-abandonedHandleSrcTop_982c7e02-2cce-4202-b72c-bee08f44e11a-prior-auth-approvedHandleTargetBottom_7d04e809-9419-4673-800b-ea2c3d7c04aa", + "type": "smoothstep", "source": "prior-auth-abandoned", "target": "prior-auth-approved", + "animated": true, "sourceHandle": "HandleSrcTop_prior-auth-abandoned", "targetHandle": + "HandleTargetBottom_prior-auth-approved", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-continuing-old-treatmentHandleSrcTop_40cd6e6c-c21c-45bf-b94c-62092b2b2510-sent-to-pharmacyHandleTargetBottom_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "continuing-old-treatment", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcTop_continuing-old-treatment", + "targetHandle": "HandleTargetBottom_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-startHandleSrcBottom_a8a336be-e2ef-4336-bb18-0dfa4b5b9727-stopping-old-treatmentHandleTargetLeft_26bbcfc7-e81d-48ac-88aa-7bdcb209dc36", + "type": "smoothstep", "source": "start", "target": "stopping-old-treatment", + "animated": true, "sourceHandle": "HandleSrcBottom_start", "targetHandle": + "HandleTargetLeft_stopping-old-treatment", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-startHandleSrcBottom_a8a336be-e2ef-4336-bb18-0dfa4b5b9727-continuing-old-treatmentHandleTargetLeft_40cd6e6c-c21c-45bf-b94c-62092b2b2510", + "type": "smoothstep", "source": "start", "target": "continuing-old-treatment", + "animated": true, "sourceHandle": "HandleSrcBottom_start", "targetHandle": + "HandleTargetLeft_continuing-old-treatment", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-prior-auth-approvedHandleSrcTop_7d04e809-9419-4673-800b-ea2c3d7c04aa-sent-to-pharmacyHandleTargetBottom_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "prior-auth-approved", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcTop_prior-auth-approved", "targetHandle": + "HandleTargetBottom_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, {"id": + "consent-requested", "data": {"type": "DEFAULT", "label": "Consent Requested"}, + "type": "graphNode", "position": {"x": 460, "y": -40}}, {"id": "consent-received", + "data": {"type": "DEFAULT", "label": "Consent Received"}, "type": "graphNode", + "position": {"x": 640, "y": -40}}, {"id": "reactflow__edge-consent-receivedHandleSrcRight_2e7445fb-8611-43bd-b750-af720c1530c1-records-requestedHandleTargetLeft_99edae56-fbb6-4bd5-95d0-a02e8b53c097", + "type": "smoothstep", "source": "consent-received", "target": "records-requested", + "animated": true, "sourceHandle": "HandleSrcRight_consent-received", "targetHandle": + "HandleTargetLeft_records-requested", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-consent-requestedHandleSrcRight_b56feb59-d9ad-46e7-8741-a20ad73112b7-consent-receivedHandleTargetLeft_2e7445fb-8611-43bd-b750-af720c1530c1", + "type": "smoothstep", "source": "consent-requested", "target": "consent-received", + "animated": true, "sourceHandle": "HandleSrcRight_consent-requested", "targetHandle": + "HandleTargetLeft_consent-received", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-startHandleSrcTop_712c1b68-4ccd-4f94-8641-5721b6148ed8-consent-requestedHandleTargetLeft_b56feb59-d9ad-46e7-8741-a20ad73112b7", + "type": "smoothstep", "source": "start", "target": "consent-requested", "animated": + true, "sourceHandle": "HandleSrcTop_start", "targetHandle": "HandleTargetLeft_consent-requested", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-target-2-patient", "title": + "Target 2 Patient", "description": "Delayers - en route to top of treatment.", + "phases": [{"name": "start", "title": "Start", "type": "START", "description": + "", "autoFinishProgram": false, "navigateTo": [{"name": "finish"}]}, {"name": + "finish", "title": "Finish", "type": "FINISH", "description": "", "autoFinishProgram": + false, "navigateTo": []}], "nodes": [{"id": "start", "data": {"label": "Start"}, + "type": "graphNode", "position": {"x": 20, "y": 20}}, {"id": "finish", "data": + {"type": "FINISH", "label": "Finish"}, "type": "graphNode", "position": {"x": + 300, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_713b0fea-09cb-4c09-98da-bcb71c6cc9e5-finishHandleTargetLeft_d0fe8672-eafd-4b25-98b8-8845e89953a8", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-non-target-patient", "title": + "Non-Target Patient", "description": "All other non-target patients that do + not meet the criteria for other care plans.", "phases": [{"name": "start", + "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}]}, {"name": "finish", "title": "Finish", + "type": "FINISH", "description": "", "autoFinishProgram": false, "navigateTo": + []}], "nodes": [{"id": "start", "data": {"label": "Start"}, "type": "graphNode", + "position": {"x": 20, "y": 20}}, {"id": "finish", "data": {"label": "Finish"}, + "type": "graphNode", "position": {"x": 1520, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_34f0e25d-bb67-4d65-9dd2-b7bca6e1bd73-finishHandleTargetLeft_4c1007b4-98fa-45fc-b64b-678f7fbc880a", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}]' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:15 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '12829' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_81ee7581-0f2d-4ad6-a3a2-d81fcd1dd971 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/current/prog-target-patient + response: + body: + string: '{"id": "77d60b23-6d23-4292-b007-836a0b14be8f", "createdByName": "createdByName_REDACTED_9f40c537-90c1-4de8-a830-d3f25be8348d", + "createdAt": "2023-10-31T02:10:16.204Z", "updatedByName": "updatedByName_REDACTED_694a7649-af7b-44b4-8e33-4f70c82cd43a", + "updatedAt": "2023-10-31T02:10:16.210Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:10:16.209Z", + "createdBy": "createdBy_REDACTED_b582ffef-4dfa-442e-851a-74b4cdcef786", "createdByName": + "createdByName_REDACTED_d41d8d98-b425-47e6-9290-7d204d008ea4", "name": "start", + "title": "Start", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:10:16.209Z", "createdBy": "createdBy_REDACTED_5cc41318-2817-47b2-a3ce-a0a9384e3431", + "createdByName": "createdByName_REDACTED_c4fb329d-791a-47c0-897d-f1de24dcf457", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}]}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:16 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '963' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/TestProgram.test_update.yaml b/test/cassettes/TestProgram.test_update.yaml new file mode 100644 index 0000000..0421980 --- /dev/null +++ b/test/cassettes/TestProgram.test_update.yaml @@ -0,0 +1,276 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_9a3dfce4-1178-4f45-8e58-f683604bd00f + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/formations/current/programs?page=0 + response: + body: + string: '[{"name": "prog-target-patient", "title": "Target Patient", "description": + "Moderate to severe patients, either on biologics or oral treatment.", "phases": + [{"name": "start", "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}, {"name": "continuing-old-treatment"}, + {"name": "stopping-old-treatment"}, {"name": "consent-requested"}]}, {"name": + "finish", "title": "Finish", "type": "FINISH", "description": "", "autoFinishProgram": + false, "navigateTo": []}, {"name": "records-requested", "title": "Records + Requested", "type": "DEFAULT", "description": "", "autoFinishProgram": false, + "navigateTo": [{"name": "records-received"}]}, {"name": "records-received", + "title": "Records Received", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": []}, {"name": "starting-new-treatment", "title": "Starting + New Treatment", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "prior-auth-requested"}, {"name": "sent-to-pharmacy"}]}, + {"name": "continuing-old-treatment", "title": "Continuing Old Treatment", + "type": "DEFAULT", "description": "", "autoFinishProgram": false, "navigateTo": + [{"name": "prior-auth-requested"}, {"name": "sent-to-pharmacy"}]}, {"name": + "prior-auth-requested", "title": "Prior Auth Requested", "type": "DEFAULT", + "description": "", "autoFinishProgram": false, "navigateTo": [{"name": "prior-auth-approved"}, + {"name": "prior-auth-abandoned"}]}, {"name": "prior-auth-approved", "title": + "Prior Auth Approved", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "sent-to-pharmacy"}]}, {"name": "prior-auth-abandoned", + "title": "Prior Auth Abandoned", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "prior-auth-approved"}]}, {"name": "sent-to-pharmacy", + "title": "Sent to Pharmacy", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "confirmed-patient-filled"}]}, {"name": "confirmed-patient-filled", + "title": "Confirmed Patient Filled", "type": "DEFAULT", "description": "", + "autoFinishProgram": false, "navigateTo": []}, {"name": "stopping-old-treatment", + "title": "Stopping Old Treatment", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "starting-new-treatment"}]}, {"name": "consent-requested", + "title": "Consent Requested", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "consent-received"}]}, {"name": "consent-received", + "title": "Consent Received", "type": "DEFAULT", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "records-requested"}]}], "nodes": [{"id": "start", + "data": {"type": "START", "label": "Start"}, "type": "graphNode", "position": + {"x": 340, "y": 20}}, {"id": "finish", "data": {"type": "FINISH", "label": + "Finish"}, "type": "graphNode", "position": {"x": 1120, "y": 20}}, {"id": + "reactflow__edge-startHandleSrcRight_025adb09-c24a-45f9-b5a5-d1a44450ff43-finishHandleTargetLeft_5f5f5e64-5959-46b2-8e36-c85a86e60456", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}, {"id": "records-requested", "data": {"type": + "DEFAULT", "label": "Records Requested"}, "type": "graphNode", "position": + {"x": 800, "y": -40}}, {"id": "records-received", "data": {"type": "DEFAULT", + "label": "Records Received"}, "type": "graphNode", "position": {"x": 980, + "y": -40}}, {"id": "starting-new-treatment", "data": {"type": "DEFAULT", "label": + "Starting New Treatment"}, "type": "graphNode", "position": {"x": 640, "y": + 80}}, {"id": "continuing-old-treatment", "data": {"type": "DEFAULT", "label": + "Continuing Old Treatment"}, "type": "graphNode", "position": {"x": 440, "y": + 140}}, {"id": "prior-auth-requested", "data": {"type": "DEFAULT", "label": + "Prior Auth Requested"}, "type": "graphNode", "position": {"x": 660, "y": + 160}}, {"id": "prior-auth-approved", "data": {"type": "DEFAULT", "label": + "Prior Auth Approved"}, "type": "graphNode", "position": {"x": 840, "y": 160}}, + {"id": "prior-auth-abandoned", "data": {"type": "DEFAULT", "label": "Prior + Auth Abandoned"}, "type": "graphNode", "position": {"x": 760, "y": 220}}, + {"id": "sent-to-pharmacy", "data": {"type": "DEFAULT", "label": "Sent to Pharmacy"}, + "type": "graphNode", "position": {"x": 860, "y": 80}}, {"id": "confirmed-patient-filled", + "data": {"type": "DEFAULT", "label": "Confirmed Patient Filled"}, "type": + "graphNode", "position": {"x": 1020, "y": 80}}, {"id": "reactflow__edge-records-requestedHandleSrcRight_6672da4b-34f4-42fb-81b3-5d7e785c5e1d-records-receivedHandleTargetLeft_1c3c44da-11c5-4da6-9e79-94f1eb86a5c5", + "type": "smoothstep", "source": "records-requested", "target": "records-received", + "animated": true, "sourceHandle": "HandleSrcRight_records-requested", "targetHandle": + "HandleTargetLeft_records-received", "arrowHeadType": "arrowclosed"}, {"id": + "stopping-old-treatment", "data": {"type": "DEFAULT", "label": "Stopping Old + Treatment"}, "type": "graphNode", "position": {"x": 440, "y": 80}}, {"id": + "reactflow__edge-stopping-old-treatmentHandleSrcRight_26bbcfc7-e81d-48ac-88aa-7bdcb209dc36-starting-new-treatmentHandleTargetLeft_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6", + "type": "smoothstep", "source": "stopping-old-treatment", "target": "starting-new-treatment", + "animated": true, "sourceHandle": "HandleSrcRight_stopping-old-treatment", + "targetHandle": "HandleTargetLeft_starting-new-treatment", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-starting-new-treatmentHandleSrcBottom_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6-prior-auth-requestedHandleTargetTop_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10", + "type": "smoothstep", "source": "starting-new-treatment", "target": "prior-auth-requested", + "animated": true, "sourceHandle": "HandleSrcBottom_starting-new-treatment", + "targetHandle": "HandleTargetTop_prior-auth-requested", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-continuing-old-treatmentHandleSrcRight_40cd6e6c-c21c-45bf-b94c-62092b2b2510-prior-auth-requestedHandleTargetLeft_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10", + "type": "smoothstep", "source": "continuing-old-treatment", "target": "prior-auth-requested", + "animated": true, "sourceHandle": "HandleSrcRight_continuing-old-treatment", + "targetHandle": "HandleTargetLeft_prior-auth-requested", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-prior-auth-requestedHandleSrcRight_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10-prior-auth-approvedHandleTargetLeft_7d04e809-9419-4673-800b-ea2c3d7c04aa", + "type": "smoothstep", "source": "prior-auth-requested", "target": "prior-auth-approved", + "animated": true, "sourceHandle": "HandleSrcRight_prior-auth-requested", "targetHandle": + "HandleTargetLeft_prior-auth-approved", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-sent-to-pharmacyHandleSrcRight_e1ad3528-270a-45bf-9757-91fe3ecb9d23-confirmed-patient-filledHandleTargetLeft_2505253d-32d6-4020-8e16-722b4813a5a7", + "type": "smoothstep", "source": "sent-to-pharmacy", "target": "confirmed-patient-filled", + "animated": true, "sourceHandle": "HandleSrcRight_sent-to-pharmacy", "targetHandle": + "HandleTargetLeft_confirmed-patient-filled", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-starting-new-treatmentHandleSrcRight_0fec4bd7-99f2-4f0f-b21f-7875bf7b00a6-sent-to-pharmacyHandleTargetLeft_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "starting-new-treatment", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcRight_starting-new-treatment", + "targetHandle": "HandleTargetLeft_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-prior-auth-requestedHandleSrcBottom_d27d5d34-3c7d-4a7d-b222-25b99dbeeb10-prior-auth-abandonedHandleTargetLeft_982c7e02-2cce-4202-b72c-bee08f44e11a", + "type": "smoothstep", "source": "prior-auth-requested", "target": "prior-auth-abandoned", + "animated": true, "sourceHandle": "HandleSrcBottom_prior-auth-requested", + "targetHandle": "HandleTargetLeft_prior-auth-abandoned", "arrowHeadType": + "arrowclosed"}, {"id": "reactflow__edge-prior-auth-abandonedHandleSrcTop_982c7e02-2cce-4202-b72c-bee08f44e11a-prior-auth-approvedHandleTargetBottom_7d04e809-9419-4673-800b-ea2c3d7c04aa", + "type": "smoothstep", "source": "prior-auth-abandoned", "target": "prior-auth-approved", + "animated": true, "sourceHandle": "HandleSrcTop_prior-auth-abandoned", "targetHandle": + "HandleTargetBottom_prior-auth-approved", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-continuing-old-treatmentHandleSrcTop_40cd6e6c-c21c-45bf-b94c-62092b2b2510-sent-to-pharmacyHandleTargetBottom_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "continuing-old-treatment", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcTop_continuing-old-treatment", + "targetHandle": "HandleTargetBottom_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-startHandleSrcBottom_a8a336be-e2ef-4336-bb18-0dfa4b5b9727-stopping-old-treatmentHandleTargetLeft_26bbcfc7-e81d-48ac-88aa-7bdcb209dc36", + "type": "smoothstep", "source": "start", "target": "stopping-old-treatment", + "animated": true, "sourceHandle": "HandleSrcBottom_start", "targetHandle": + "HandleTargetLeft_stopping-old-treatment", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-startHandleSrcBottom_a8a336be-e2ef-4336-bb18-0dfa4b5b9727-continuing-old-treatmentHandleTargetLeft_40cd6e6c-c21c-45bf-b94c-62092b2b2510", + "type": "smoothstep", "source": "start", "target": "continuing-old-treatment", + "animated": true, "sourceHandle": "HandleSrcBottom_start", "targetHandle": + "HandleTargetLeft_continuing-old-treatment", "arrowHeadType": "arrowclosed"}, + {"id": "reactflow__edge-prior-auth-approvedHandleSrcTop_7d04e809-9419-4673-800b-ea2c3d7c04aa-sent-to-pharmacyHandleTargetBottom_e1ad3528-270a-45bf-9757-91fe3ecb9d23", + "type": "smoothstep", "source": "prior-auth-approved", "target": "sent-to-pharmacy", + "animated": true, "sourceHandle": "HandleSrcTop_prior-auth-approved", "targetHandle": + "HandleTargetBottom_sent-to-pharmacy", "arrowHeadType": "arrowclosed"}, {"id": + "consent-requested", "data": {"type": "DEFAULT", "label": "Consent Requested"}, + "type": "graphNode", "position": {"x": 460, "y": -40}}, {"id": "consent-received", + "data": {"type": "DEFAULT", "label": "Consent Received"}, "type": "graphNode", + "position": {"x": 640, "y": -40}}, {"id": "reactflow__edge-consent-receivedHandleSrcRight_2e7445fb-8611-43bd-b750-af720c1530c1-records-requestedHandleTargetLeft_99edae56-fbb6-4bd5-95d0-a02e8b53c097", + "type": "smoothstep", "source": "consent-received", "target": "records-requested", + "animated": true, "sourceHandle": "HandleSrcRight_consent-received", "targetHandle": + "HandleTargetLeft_records-requested", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-consent-requestedHandleSrcRight_b56feb59-d9ad-46e7-8741-a20ad73112b7-consent-receivedHandleTargetLeft_2e7445fb-8611-43bd-b750-af720c1530c1", + "type": "smoothstep", "source": "consent-requested", "target": "consent-received", + "animated": true, "sourceHandle": "HandleSrcRight_consent-requested", "targetHandle": + "HandleTargetLeft_consent-received", "arrowHeadType": "arrowclosed"}, {"id": + "reactflow__edge-startHandleSrcTop_712c1b68-4ccd-4f94-8641-5721b6148ed8-consent-requestedHandleTargetLeft_b56feb59-d9ad-46e7-8741-a20ad73112b7", + "type": "smoothstep", "source": "start", "target": "consent-requested", "animated": + true, "sourceHandle": "HandleSrcTop_start", "targetHandle": "HandleTargetLeft_consent-requested", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-target-2-patient", "title": + "Target 2 Patient", "description": "Delayers - en route to top of treatment.", + "phases": [{"name": "start", "title": "Start", "type": "START", "description": + "", "autoFinishProgram": false, "navigateTo": [{"name": "finish"}]}, {"name": + "finish", "title": "Finish", "type": "FINISH", "description": "", "autoFinishProgram": + false, "navigateTo": []}], "nodes": [{"id": "start", "data": {"label": "Start"}, + "type": "graphNode", "position": {"x": 20, "y": 20}}, {"id": "finish", "data": + {"type": "FINISH", "label": "Finish"}, "type": "graphNode", "position": {"x": + 300, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_713b0fea-09cb-4c09-98da-bcb71c6cc9e5-finishHandleTargetLeft_d0fe8672-eafd-4b25-98b8-8845e89953a8", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}, {"name": "prog-non-target-patient", "title": + "Non-Target Patient", "description": "All other non-target patients that do + not meet the criteria for other care plans.", "phases": [{"name": "start", + "title": "Start", "type": "START", "description": "", "autoFinishProgram": + false, "navigateTo": [{"name": "finish"}]}, {"name": "finish", "title": "Finish", + "type": "FINISH", "description": "", "autoFinishProgram": false, "navigateTo": + []}], "nodes": [{"id": "start", "data": {"label": "Start"}, "type": "graphNode", + "position": {"x": 20, "y": 20}}, {"id": "finish", "data": {"label": "Finish"}, + "type": "graphNode", "position": {"x": 1520, "y": 20}}, {"id": "reactflow__edge-startHandleSrcRight_34f0e25d-bb67-4d65-9dd2-b7bca6e1bd73-finishHandleTargetLeft_4c1007b4-98fa-45fc-b64b-678f7fbc880a", + "type": "smoothstep", "source": "start", "target": "finish", "animated": true, + "sourceHandle": "HandleSrcRight_start", "targetHandle": "HandleTargetLeft_finish", + "arrowHeadType": "arrowclosed"}]}]' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:11:02 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '12829' + status: + code: 200 + message: OK +- request: + body: '{"phaseName": "finish"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_9a3dfce4-1178-4f45-8e58-f683604bd00f + Connection: + - keep-alive + Content-Length: + - '23' + Content-Type: + - application/json + User-Agent: + - python-welkin/0.1.1 + method: PATCH + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/prog-target-patient + response: + body: + string: '{"id": "77d60b23-6d23-4292-b007-836a0b14be8f", "createdByName": "createdByName_REDACTED_46a14ef7-aa16-4286-9a44-d1a4e91a5cfe", + "createdAt": "2023-10-31T02:10:16.204Z", "updatedByName": "updatedByName_REDACTED_0ed30a91-f19c-4882-9aa9-2d333d4e0acd", + "updatedAt": "2023-10-31T02:11:02.904Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:11:02.903Z", + "createdBy": "createdBy_REDACTED_0f85b917-5b1d-4baf-be56-c39501eebc5d", "createdByName": + "createdByName_REDACTED_157ef5b7-2ab8-48c8-8b02-582334267edf", "name": "finish", + "title": "Finish", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:10:16.209Z", "createdBy": "createdBy_REDACTED_cfea345f-fa4a-4a4e-a6c4-2b920196b401", + "createdByName": "createdByName_REDACTED_a2abcbc0-89b2-4593-8d30-2d865fc40141", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}, {"timestamp": "2023-10-31T02:11:02.903Z", "createdBy": + "createdBy_REDACTED_cd508893-1e9b-42d1-9496-255dea703f21", "createdByName": + "createdByName_REDACTED_a585ae59-ef98-40d8-8b41-2040869dcd65", "name": "finish", + "title": "Finish", "description": "", "currentVersion": "92", "deleted": false}]}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:11:02 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '1187' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/TestPrograms.test_read.yaml b/test/cassettes/TestPrograms.test_read.yaml new file mode 100644 index 0000000..6872130 --- /dev/null +++ b/test/cassettes/TestPrograms.test_read.yaml @@ -0,0 +1,75 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_cdbf8879-481a-4cdd-af08-c5a0fc54f3b1 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs?page=0 + response: + body: + string: '{"data": [{"id": null, "createdByName": "createdByName_REDACTED_81a5b561-afc0-4fb3-804b-9baee07b6a8c", + "createdAt": null, "updatedByName": "updatedByName_REDACTED_02620078-7370-4899-852b-61b8f855a48d", + "updatedAt": null, "programName": "prog-target-2-patient", "programTitle": + "Target 2 Patient", "programDescription": "Delayers - en route to top of treatment.", + "assigned": false, "patientId": null, "currentPhase": null, "status": null, + "compatibleWithCurrentVersion": false, "pathHistory": []}, {"id": null, "createdByName": + "createdByName_REDACTED_6be765b8-0e18-425e-ae4e-88092280c9fe", "createdAt": + null, "updatedByName": "updatedByName_REDACTED_85563121-fbcc-4f10-912e-cfc75bc595e1", + "updatedAt": null, "programName": "prog-non-target-patient", "programTitle": + "Non-Target Patient", "programDescription": "All other non-target patients + that do not meet the criteria for other care plans.", "assigned": false, "patientId": + null, "currentPhase": null, "status": null, "compatibleWithCurrentVersion": + false, "pathHistory": []}, {"id": null, "createdByName": "createdByName_REDACTED_6ed5abd3-74fd-4071-b732-c204b1243731", + "createdAt": null, "updatedByName": "updatedByName_REDACTED_932a65a7-1273-4d8b-9cbe-4068dddc95ed", + "updatedAt": null, "programName": "prog-target-patient", "programTitle": "Target + Patient", "programDescription": "Moderate to severe patients, either on biologics + or oral treatment.", "assigned": false, "patientId": null, "currentPhase": + null, "status": null, "compatibleWithCurrentVersion": false, "pathHistory": + []}], "metaInfo": {"page": 0, "pageSize": 20, "totalElements": 3, "numberOfElements": + 3, "lastPage": true, "firstPage": true, "totalPages": 1}}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:15 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '1239' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/fixtures/patient__TestProgram.test_delete.yaml b/test/cassettes/fixtures/patient__TestProgram.test_delete.yaml new file mode 100644 index 0000000..5e4a3f0 --- /dev/null +++ b/test/cassettes/fixtures/patient__TestProgram.test_delete.yaml @@ -0,0 +1,84 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_cdbf8879-481a-4cdd-af08-c5a0fc54f3b1 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/12345678-1234-1234-1234-1234567890ab?type=EGUID + response: + body: + string: '{"createdByName": "createdByName_REDACTED_3787d4d8-394d-44dc-b136-9b860521a0af", + "lastName": "Patient", "country": null, "secondaryEmail": null, "gender": + "UNKNOWN", "city": null, "timezone": null, "careTeamMembers": [], "secondaryPhoneCapabilities": + [], "createdAt": "2023-10-27T23:19:20.506Z", "accessCode": null, "addressLine1": + null, "addressLine2": null, "id": "de5e1a93-70b0-4ed4-868f-3854becc383c", + "state": null, "secondaryLanguage": null, "email": "test.patient@example.com", + "careTeam": [], "updatedAt": "2023-10-27T23:19:20.506Z", "primaryPhoneCapabilities": + [], "pointOfContact": null, "zip": null, "updatedBy": "updatedBy_REDACTED_397d6410-0119-4452-a443-ce14d8b19119", + "preferableInstancePhoneId": null, "updatedByName": "updatedByName_REDACTED_0f50023d-76aa-4747-81a8-0e880cf9053d", + "mrn": null, "externalId": null, "externalGuid": "12345678-1234-1234-1234-1234567890ab", + "patientPrograms": [{"id": "53e7f5de-67d7-475f-9443-6b4dedf14848", "createdByName": + "createdByName_REDACTED_8fe5924d-f27c-473a-a0d8-04ae4b480ffe", "createdAt": + "2023-10-31T02:05:28.717Z", "updatedByName": "updatedByName_REDACTED_86a500dd-5193-4882-8186-cf5ab9ea2115", + "updatedAt": "2023-10-31T02:05:28.721Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:05:28.720Z", + "createdBy": "createdBy_REDACTED_83e4e86f-cbf2-46d0-b244-337c905318f0", "createdByName": + "createdByName_REDACTED_ea549410-716b-487e-9267-7f2ab471a7e8", "name": "start", + "title": "Start", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:05:28.720Z", "createdBy": "createdBy_REDACTED_153f6c5f-36a1-4220-b28c-0ff52e023be7", + "createdByName": "createdByName_REDACTED_37ffb982-e10f-4f22-b86c-bfa58fd5af47", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}]}], "nric": null, "birthDate": null, "cadence": [], "firstName": + "Test", "patientRegionTitle": null, "createdBy": "createdBy_REDACTED_57038b8c-441a-43f6-8530-2342b4b511ce", + "phone": null, "middleName": null, "patientTerritories": [], "patientRegion": + null, "maritalStatus": "UKN", "primaryLanguage": "ENGLISH", "secondaryPhone": + null, "patientTerritory": null}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:14 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '2034' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/fixtures/patient__TestProgram.test_read[id].yaml b/test/cassettes/fixtures/patient__TestProgram.test_read[id].yaml new file mode 100644 index 0000000..8699f8b --- /dev/null +++ b/test/cassettes/fixtures/patient__TestProgram.test_read[id].yaml @@ -0,0 +1,84 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_81ee7581-0f2d-4ad6-a3a2-d81fcd1dd971 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/12345678-1234-1234-1234-1234567890ab?type=EGUID + response: + body: + string: '{"createdByName": "createdByName_REDACTED_7110ecfd-7888-4132-8dcc-c892e7fb442d", + "lastName": "Patient", "country": null, "secondaryEmail": null, "gender": + "UNKNOWN", "city": null, "timezone": null, "careTeamMembers": [], "secondaryPhoneCapabilities": + [], "createdAt": "2023-10-27T23:19:20.506Z", "accessCode": null, "addressLine1": + null, "addressLine2": null, "id": "de5e1a93-70b0-4ed4-868f-3854becc383c", + "state": null, "secondaryLanguage": null, "email": "test.patient@example.com", + "careTeam": [], "updatedAt": "2023-10-27T23:19:20.506Z", "primaryPhoneCapabilities": + [], "pointOfContact": null, "zip": null, "updatedBy": "updatedBy_REDACTED_61dfe2a9-0a67-4b44-bc4d-179a22559577", + "preferableInstancePhoneId": null, "updatedByName": "updatedByName_REDACTED_9734b0ff-3bdc-46da-baca-da61007e167c", + "mrn": null, "externalId": null, "externalGuid": "12345678-1234-1234-1234-1234567890ab", + "patientPrograms": [{"id": "53e7f5de-67d7-475f-9443-6b4dedf14848", "createdByName": + "createdByName_REDACTED_2e1d77c5-375d-46f3-ab99-3155452e72f5", "createdAt": + "2023-10-31T02:05:28.717Z", "updatedByName": "updatedByName_REDACTED_40a5a934-3e45-4737-afb1-9dc965b64471", + "updatedAt": "2023-10-31T02:05:28.721Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:05:28.720Z", + "createdBy": "createdBy_REDACTED_1aa62f75-0953-4b2b-a0ae-583c14b39bc4", "createdByName": + "createdByName_REDACTED_f49902c1-aee3-4586-9157-381b63a2ae76", "name": "start", + "title": "Start", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:05:28.720Z", "createdBy": "createdBy_REDACTED_ee8c682a-10ce-4116-8e2c-80f84cdb75e8", + "createdByName": "createdByName_REDACTED_ee114448-3e04-4152-9a1a-f742f6276a6a", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}]}], "nric": null, "birthDate": null, "cadence": [], "firstName": + "Test", "patientRegionTitle": null, "createdBy": "createdBy_REDACTED_3a280eb7-5af1-47dc-8e5e-c5f49bc375fd", + "phone": null, "middleName": null, "patientTerritories": [], "patientRegion": + null, "maritalStatus": "UKN", "primaryLanguage": "ENGLISH", "secondaryPhone": + null, "patientTerritory": null}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:14 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '2034' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/fixtures/patient__TestProgram.test_read[programName].yaml b/test/cassettes/fixtures/patient__TestProgram.test_read[programName].yaml new file mode 100644 index 0000000..0e6a5f8 --- /dev/null +++ b/test/cassettes/fixtures/patient__TestProgram.test_read[programName].yaml @@ -0,0 +1,70 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_81ee7581-0f2d-4ad6-a3a2-d81fcd1dd971 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/12345678-1234-1234-1234-1234567890ab?type=EGUID + response: + body: + string: '{"createdByName": "createdByName_REDACTED_0c1a375e-fb29-465b-a0a3-f54e46c8d049", + "lastName": "Patient", "country": null, "secondaryEmail": null, "gender": + "UNKNOWN", "city": null, "timezone": null, "careTeamMembers": [], "secondaryPhoneCapabilities": + [], "createdAt": "2023-10-27T23:19:20.506Z", "accessCode": null, "addressLine1": + null, "addressLine2": null, "id": "de5e1a93-70b0-4ed4-868f-3854becc383c", + "state": null, "secondaryLanguage": null, "email": "test.patient@example.com", + "careTeam": [], "updatedAt": "2023-10-27T23:19:20.506Z", "primaryPhoneCapabilities": + [], "pointOfContact": null, "zip": null, "updatedBy": "updatedBy_REDACTED_524b5efd-76a4-4971-ba5e-6b4b7fe61ff5", + "preferableInstancePhoneId": null, "updatedByName": "updatedByName_REDACTED_2ba2f3e2-f75a-495d-87db-3bd55a298174", + "mrn": null, "externalId": null, "externalGuid": "12345678-1234-1234-1234-1234567890ab", + "patientPrograms": [], "nric": null, "birthDate": null, "cadence": [], "firstName": + "Test", "patientRegionTitle": null, "createdBy": "createdBy_REDACTED_590dd304-97a1-471b-8abc-6a046d5542e9", + "phone": null, "middleName": null, "patientTerritories": [], "patientRegion": + null, "maritalStatus": "UKN", "primaryLanguage": "ENGLISH", "secondaryPhone": + null, "patientTerritory": null}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:15 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '1071' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/fixtures/patient__TestProgram.test_update.yaml b/test/cassettes/fixtures/patient__TestProgram.test_update.yaml new file mode 100644 index 0000000..9eba57c --- /dev/null +++ b/test/cassettes/fixtures/patient__TestProgram.test_update.yaml @@ -0,0 +1,84 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_7a764bd7-4131-4ef6-a102-6efd9c869a1c + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/12345678-1234-1234-1234-1234567890ab?type=EGUID + response: + body: + string: '{"createdByName": "createdByName_REDACTED_1db820cc-08a1-4598-aaa7-0bfa05012815", + "lastName": "Patient", "country": null, "secondaryEmail": null, "gender": + "UNKNOWN", "city": null, "timezone": null, "careTeamMembers": [], "secondaryPhoneCapabilities": + [], "createdAt": "2023-10-27T23:19:20.506Z", "accessCode": null, "addressLine1": + null, "addressLine2": null, "id": "de5e1a93-70b0-4ed4-868f-3854becc383c", + "state": null, "secondaryLanguage": null, "email": "test.patient@example.com", + "careTeam": [], "updatedAt": "2023-10-27T23:19:20.506Z", "primaryPhoneCapabilities": + [], "pointOfContact": null, "zip": null, "updatedBy": "updatedBy_REDACTED_22721fb2-a223-4c09-9563-e55254785a20", + "preferableInstancePhoneId": null, "updatedByName": "updatedByName_REDACTED_ebc09ed9-3d69-4e31-9486-db8f946a796a", + "mrn": null, "externalId": null, "externalGuid": "12345678-1234-1234-1234-1234567890ab", + "patientPrograms": [{"id": "53e7f5de-67d7-475f-9443-6b4dedf14848", "createdByName": + "createdByName_REDACTED_3e8a4c70-1021-4181-8314-c1cd5d24d2dd", "createdAt": + "2023-10-31T02:05:28.717Z", "updatedByName": "updatedByName_REDACTED_7675da11-62df-4823-b6dc-c4947ce9f238", + "updatedAt": "2023-10-31T02:05:28.721Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:05:28.720Z", + "createdBy": "createdBy_REDACTED_883b3c82-d17a-4384-85b6-e8d386667f46", "createdByName": + "createdByName_REDACTED_01addf2b-7b5e-47c2-821a-3e82ae4fd4a6", "name": "start", + "title": "Start", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:05:28.720Z", "createdBy": "createdBy_REDACTED_5914e5a6-0720-4195-8616-1eea59d66b39", + "createdByName": "createdByName_REDACTED_bfcca769-ca87-40f4-b8af-ed65555e9f93", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}]}], "nric": null, "birthDate": null, "cadence": [], "firstName": + "Test", "patientRegionTitle": null, "createdBy": "createdBy_REDACTED_d10ef850-31ef-4505-a7c8-05b5a48447b0", + "phone": null, "middleName": null, "patientTerritories": [], "patientRegion": + null, "maritalStatus": "UKN", "primaryLanguage": "ENGLISH", "secondaryPhone": + null, "patientTerritory": null}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:14 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '2034' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/fixtures/patient__TestPrograms.test_read.yaml b/test/cassettes/fixtures/patient__TestPrograms.test_read.yaml new file mode 100644 index 0000000..125f7f7 --- /dev/null +++ b/test/cassettes/fixtures/patient__TestPrograms.test_read.yaml @@ -0,0 +1,70 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_cdbf8879-481a-4cdd-af08-c5a0fc54f3b1 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/12345678-1234-1234-1234-1234567890ab?type=EGUID + response: + body: + string: '{"createdByName": "createdByName_REDACTED_5a78395f-9a3c-49de-ab7b-23c2f37491a4", + "lastName": "Patient", "country": null, "secondaryEmail": null, "gender": + "UNKNOWN", "city": null, "timezone": null, "careTeamMembers": [], "secondaryPhoneCapabilities": + [], "createdAt": "2023-10-27T23:19:20.506Z", "accessCode": null, "addressLine1": + null, "addressLine2": null, "id": "de5e1a93-70b0-4ed4-868f-3854becc383c", + "state": null, "secondaryLanguage": null, "email": "test.patient@example.com", + "careTeam": [], "updatedAt": "2023-10-27T23:19:20.506Z", "primaryPhoneCapabilities": + [], "pointOfContact": null, "zip": null, "updatedBy": "updatedBy_REDACTED_b5975051-e9d1-4105-91c2-bcc61ed5ff90", + "preferableInstancePhoneId": null, "updatedByName": "updatedByName_REDACTED_dd32de08-52c1-4de8-b740-4dcf3562234c", + "mrn": null, "externalId": null, "externalGuid": "12345678-1234-1234-1234-1234567890ab", + "patientPrograms": [], "nric": null, "birthDate": null, "cadence": [], "firstName": + "Test", "patientRegionTitle": null, "createdBy": "createdBy_REDACTED_15d6858b-ec41-4bf4-b806-66412df4b677", + "phone": null, "middleName": null, "patientTerritories": [], "patientRegion": + null, "maritalStatus": "UKN", "primaryLanguage": "ENGLISH", "secondaryPhone": + null, "patientTerritory": null}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:15 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '1071' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/fixtures/patient_program__TestProgram.test_delete.yaml b/test/cassettes/fixtures/patient_program__TestProgram.test_delete.yaml new file mode 100644 index 0000000..7e8cb75 --- /dev/null +++ b/test/cassettes/fixtures/patient_program__TestProgram.test_delete.yaml @@ -0,0 +1,69 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_cdbf8879-481a-4cdd-af08-c5a0fc54f3b1 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/current/prog-target-patient + response: + body: + string: '{"id": "53e7f5de-67d7-475f-9443-6b4dedf14848", "createdByName": "createdByName_REDACTED_796f836c-892e-4b41-a6b6-046320abab2c", + "createdAt": "2023-10-31T02:05:28.717Z", "updatedByName": "updatedByName_REDACTED_af9c9fd6-5c9a-46df-b4c3-8f8941232c58", + "updatedAt": "2023-10-31T02:05:28.721Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:05:28.720Z", + "createdBy": "createdBy_REDACTED_901bd39a-a3b4-4e5c-98d6-89f796435e72", "createdByName": + "createdByName_REDACTED_88cee94f-bfec-45e9-a092-a9c4e20a6603", "name": "start", + "title": "Start", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:05:28.720Z", "createdBy": "createdBy_REDACTED_307a66b5-ff48-4612-80d7-43fdf1a8f702", + "createdByName": "createdByName_REDACTED_2ac3d8f7-e07c-4df8-b6fd-f7ad43003fdd", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}]}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:14 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '963' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/fixtures/patient_program__TestProgram.test_read[id].yaml b/test/cassettes/fixtures/patient_program__TestProgram.test_read[id].yaml new file mode 100644 index 0000000..97bbebd --- /dev/null +++ b/test/cassettes/fixtures/patient_program__TestProgram.test_read[id].yaml @@ -0,0 +1,69 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_81ee7581-0f2d-4ad6-a3a2-d81fcd1dd971 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/current/prog-target-patient + response: + body: + string: '{"id": "53e7f5de-67d7-475f-9443-6b4dedf14848", "createdByName": "createdByName_REDACTED_bffddcd1-8dec-4f14-9a37-51a0ef394804", + "createdAt": "2023-10-31T02:05:28.717Z", "updatedByName": "updatedByName_REDACTED_974eb2ed-a7e6-4eb0-975b-b5060ad6b9bc", + "updatedAt": "2023-10-31T02:05:28.721Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:05:28.720Z", + "createdBy": "createdBy_REDACTED_f150d790-2185-45b9-935e-e5a3cd0bd0c2", "createdByName": + "createdByName_REDACTED_89468126-6416-4ec1-8eff-29a556d576b4", "name": "start", + "title": "Start", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:05:28.720Z", "createdBy": "createdBy_REDACTED_0a32843f-09ed-4257-8dd0-90d102c83afe", + "createdByName": "createdByName_REDACTED_760e9fd1-7526-4ca0-9efe-695e2130aec3", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}]}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:14 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '963' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/fixtures/patient_program__TestProgram.test_read[programName].yaml b/test/cassettes/fixtures/patient_program__TestProgram.test_read[programName].yaml new file mode 100644 index 0000000..12cc81a --- /dev/null +++ b/test/cassettes/fixtures/patient_program__TestProgram.test_read[programName].yaml @@ -0,0 +1,130 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_81ee7581-0f2d-4ad6-a3a2-d81fcd1dd971 + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/current/prog-target-patient + response: + body: + string: '[{"errorCode": "PATIENT_PROGRAM_NOT_FOUND", "componentType": "PATIENT_PROGRAM", + "message": "Patient related to program doesn''t exist", "details": {"programName": + "prog-target-patient", "patientId": "de5e1a93-70b0-4ed4-868f-3854becc383c", + "notStatus": "FINISHED"}, "date": "2023-10-31T02:10:16.035Z"}]' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:16 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '286' + status: + code: 404 + message: Not Found +- request: + body: '{"assigned": true, "phaseName": "start"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_81ee7581-0f2d-4ad6-a3a2-d81fcd1dd971 + Connection: + - keep-alive + Content-Length: + - '40' + Content-Type: + - application/json + User-Agent: + - python-welkin/0.1.1 + method: PATCH + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/prog-target-patient + response: + body: + string: '{"id": "77d60b23-6d23-4292-b007-836a0b14be8f", "createdByName": "createdByName_REDACTED_f2965ed7-e6d4-4911-9b8c-105be1f3bdc1", + "createdAt": "2023-10-31T02:10:16.204Z", "updatedByName": "updatedByName_REDACTED_cfe65b70-81c8-4c33-b79c-12674b135592", + "updatedAt": "2023-10-31T02:10:16.210Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:10:16.209Z", + "createdBy": "createdBy_REDACTED_c6e05235-517f-4c81-8f6f-25235fcb3ad8", "createdByName": + "createdByName_REDACTED_9b2881ee-0d32-420d-a6a9-99c591018ed2", "name": "start", + "title": "Start", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:10:16.209Z", "createdBy": "createdBy_REDACTED_3c4c585f-e200-4f42-8141-23716e911021", + "createdByName": "createdByName_REDACTED_a5e49667-4d24-4718-a656-98e96da012c5", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}]}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:10:16 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '963' + status: + code: 200 + message: OK +version: 1 diff --git a/test/cassettes/fixtures/patient_program__TestProgram.test_update.yaml b/test/cassettes/fixtures/patient_program__TestProgram.test_update.yaml new file mode 100644 index 0000000..3bd3810 --- /dev/null +++ b/test/cassettes/fixtures/patient_program__TestProgram.test_update.yaml @@ -0,0 +1,69 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - API_TOKEN_9a3dfce4-1178-4f45-8e58-f683604bd00f + Connection: + - keep-alive + User-Agent: + - python-welkin/0.1.1 + method: GET + uri: https://api.live.welkincloud.io/tenant_REDACTED/instance_REDACTED/patients/de5e1a93-70b0-4ed4-868f-3854becc383c/programs/current/prog-target-patient + response: + body: + string: '{"id": "77d60b23-6d23-4292-b007-836a0b14be8f", "createdByName": "createdByName_REDACTED_c39f6ee2-2030-4109-9e94-7469bdd4e8ae", + "createdAt": "2023-10-31T02:10:16.204Z", "updatedByName": "updatedByName_REDACTED_0477b685-93eb-4bae-b2a6-cd50bd8379ed", + "updatedAt": "2023-10-31T02:10:16.210Z", "programName": "prog-target-patient", + "programTitle": "Target Patient", "programDescription": "Moderate to severe + patients, either on biologics or oral treatment.", "assigned": true, "patientId": + "de5e1a93-70b0-4ed4-868f-3854becc383c", "currentPhase": {"timestamp": "2023-10-31T02:10:16.209Z", + "createdBy": "createdBy_REDACTED_9a567b17-258b-4e31-b497-c94fc64d3113", "createdByName": + "createdByName_REDACTED_3f03e301-06af-47b9-8659-4e759277ea87", "name": "start", + "title": "Start", "description": "", "currentVersion": "92", "deleted": false}, + "status": "IN_PROGRESS", "compatibleWithCurrentVersion": true, "pathHistory": + [{"timestamp": "2023-10-31T02:10:16.209Z", "createdBy": "createdBy_REDACTED_90df99b1-b748-490c-b7f5-42d6faa3d93e", + "createdByName": "createdByName_REDACTED_5aab39e6-d160-4fe8-afc9-951ec6919339", + "name": "start", "title": "Start", "description": "", "currentVersion": "92", + "deleted": false}]}' + headers: + Access-Control-Allow-Headers: + - authorization, content-type, xsrf-token, security-role + Access-Control-Allow-Methods: + - GET, POST, PUT, DELETE, PATCH, OPTIONS + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - xsrf-token + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 31 Oct 2023 02:11:02 GMT + Expires: + - '0' + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-XSS-Protection: + - 1; mode=block + content-length: + - '963' + status: + code: 200 + message: OK +version: 1 diff --git a/test/conftest.py b/test/conftest.py index 0ee1327..654ddf2 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,12 +1,16 @@ +import inspect import json import os import uuid from datetime import date, datetime, time, timedelta, timezone +from http import HTTPStatus +from pathlib import Path from uuid import uuid4 import pytest from welkin import Client +from welkin.exceptions import WelkinHTTPError def pytest_collection_modifyitems(items): @@ -107,6 +111,37 @@ def hook(dct): return hook +@pytest.fixture +def fixture_cassette(vcr, vcr_cassette_dir, vcr_cassette_name): + def _cassette(): + caller_function_name = inspect.stack()[1].function + cassette_name = f"{caller_function_name}__{vcr_cassette_name}" + fixture_path = str(Path(vcr_cassette_dir, "fixtures")) + + return vcr.use_cassette(cassette_name, cassette_library_dir=fixture_path) + + return _cassette + + +@pytest.fixture +def patient(client, fixture_cassette): + patient = client.Patient( + firstName="Test", + lastName="Patient", + email="test.patient@example.com", + externalGuid=uuid.UUID("12345678-1234-1234-1234-1234567890ab"), + ) + + with fixture_cassette(): + try: + return patient.get() + except WelkinHTTPError as exc: + if exc.response.status_code != HTTPStatus.NOT_FOUND: + raise + + return patient.create() + + @pytest.fixture def base_date(): return date(year=2022, month=9, day=15) diff --git a/test/test_authentication.py b/test/test_authentication.py index b410c47..9d731ac 100644 --- a/test/test_authentication.py +++ b/test/test_authentication.py @@ -1,4 +1,5 @@ import dbm +from pathlib import Path from requests import Request @@ -11,6 +12,12 @@ def auth_class(client): auth.tenant = "test_tenant" auth.token_method = lambda: {"token": "API_TOKEN"} + try: + auth.token + except dbm.error: + Path(DB_PATH).unlink() + return auth_class(client) + return auth diff --git a/test/test_document.py b/test/test_document.py index 1e8b7d7..b52253b 100644 --- a/test/test_document.py +++ b/test/test_document.py @@ -82,7 +82,6 @@ def test_document_summary_create(client, vcr_cassette): reason="the bytes upload hits this issue in vcr: https://github.com/kevin1024/vcrpy/issues/660 but this test shows the correct implementation" ) def test_document_summary_files_create(client, vcr_cassette): - with open("test/walrus_uJGKbRm.jpeg", "rb") as f: files = client.DocumentSummaryFiles().create( patient_id="283f50d3-0840-426f-b07b-bd8e4ab76401", diff --git a/test/test_formation.py b/test/test_formation.py index a2eb71e..953c443 100644 --- a/test/test_formation.py +++ b/test/test_formation.py @@ -13,6 +13,8 @@ Formation, Goal, Goals, + Program, + Programs, ) @@ -121,3 +123,21 @@ def test_goal_read(self, formation, vcr_cassette): assert goal_template.name == "eat-fruit" assert len(vcr_cassette) == 1 + + @pytest.mark.vcr + def test_programs_read(self, formation, vcr_cassette): + programs = formation.Programs().get() + + assert isinstance(programs, Programs) + assert isinstance(programs[0], Program) + + assert len(vcr_cassette) == 1 + + @pytest.mark.vcr + def test_program_read(self, formation, vcr_cassette): + programs = formation.Program(name="prog-non-target-patient").get() + + assert isinstance(programs, Program) + assert programs.name == "prog-non-target-patient" + + assert len(vcr_cassette) == 1 diff --git a/test/test_program.py b/test/test_program.py new file mode 100644 index 0000000..55a7c8f --- /dev/null +++ b/test/test_program.py @@ -0,0 +1,109 @@ +from http import HTTPStatus + +import pytest + +from welkin import Client +from welkin.exceptions import WelkinHTTPError +from welkin.models import ( + Patient, + PatientProgram, + PatientPrograms, + ProgramPhase, + ProgramPhases, +) +from welkin.models.formation import Program + + +@pytest.mark.vcr +class TestProgram: + @pytest.fixture + def formation(self, client: Client) -> Program: + return client.Formation().Programs().get()[0] + + @pytest.fixture + def first_phase(self, formation) -> str: + return formation.phases[0]["name"] + + @pytest.fixture + def second_phase(self, formation) -> str: + return formation.phases[1]["name"] + + @pytest.fixture + def patient_program( + self, + patient: Patient, + formation: Program, + first_phase: str, + fixture_cassette, + ) -> PatientProgram: + program = patient.PatientProgram(programName=formation.name) + + with fixture_cassette(): + try: + program = program.get() + except WelkinHTTPError as exc: + if exc.response.status_code != HTTPStatus.NOT_FOUND: + raise + + return program.update(assigned=True, phaseName=first_phase) + + if len(program.pathHistory) > 1: + program.delete() + program = program.update(assigned=True, phaseName=first_phase) + + return program + + @pytest.mark.parametrize( + "identifier", + [ + "id", + "programName", + ], + ) + def test_read( + self, patient: Patient, patient_program: PatientProgram, identifier: str + ): + prog = patient.PatientProgram( + **{identifier: getattr(patient_program, identifier)} + ).get() + + assert isinstance(prog, PatientProgram) + assert isinstance(prog.currentPhase, ProgramPhase) + assert isinstance(prog.pathHistory, ProgramPhases) + + assert prog.id == patient_program.id + + def test_read_no_id(self, client): + with pytest.raises(ValueError): + client.Patient(id="notarealid").PatientProgram().get() + + def test_update( + self, patient: Patient, patient_program: PatientProgram, second_phase: str + ): + assert patient_program.currentPhase.name != second_phase + assert len(patient_program.pathHistory) == 1 + + prog = patient.PatientProgram(programName=patient_program.programName).update( + phaseName=second_phase + ) + assert prog.currentPhase.name == second_phase + assert prog.currentPhase.name != patient_program.currentPhase.name + assert len(prog.pathHistory) == 2 + + def test_delete(self, patient: Patient, patient_program: PatientProgram): + prog = patient.PatientProgram(id=patient_program.id) + prog.delete() + + with pytest.raises(WelkinHTTPError) as excinfo: + prog.get() + + assert excinfo.value.response.status_code == 404 + + +@pytest.mark.vcr +class TestPrograms: + def test_read(self, patient): + programs = patient.PatientPrograms().get() + + assert isinstance(programs, PatientPrograms) + assert isinstance(programs[0], PatientProgram) diff --git a/welkin/client.py b/welkin/client.py index dc51d46..79b56ef 100644 --- a/welkin/client.py +++ b/welkin/client.py @@ -94,6 +94,10 @@ class Client(Session): Formation = models.Formation Patient = models.Patient Patients = models.Patients + PatientProgram = models.PatientProgram + ProgramPhase = models.ProgramPhase + ProgramPhases = models.ProgramPhases + PatientPrograms = models.PatientPrograms Schedules = models.Schedules SearchChats = models.SearchChats SMS = models.SMS diff --git a/welkin/models/__init__.py b/welkin/models/__init__.py index dbeb508..aec8dc3 100644 --- a/welkin/models/__init__.py +++ b/welkin/models/__init__.py @@ -19,6 +19,12 @@ from welkin.models.encounter import Encounter, EncounterDisposition, Encounters from welkin.models.formation import Formation from welkin.models.patient import Patient, Patients +from welkin.models.program import ( + PatientProgram, + PatientPrograms, + ProgramPhase, + ProgramPhases, +) from welkin.models.sms import SMS, SMSes from welkin.models.user import User, Users @@ -48,6 +54,10 @@ "Formation", "Patient", "Patients", + "PatientProgram", + "ProgramPhase", + "ProgramPhases", + "PatientPrograms", "Schedules", "SearchChats", "SMS", diff --git a/welkin/models/calendar.py b/welkin/models/calendar.py index 66ba660..90b1cff 100644 --- a/welkin/models/calendar.py +++ b/welkin/models/calendar.py @@ -131,7 +131,6 @@ def get( *args, **kwargs, ): - params = { "from": from_date, "to": to_date, diff --git a/welkin/models/formation.py b/welkin/models/formation.py index 8b88294..699dc49 100644 --- a/welkin/models/formation.py +++ b/welkin/models/formation.py @@ -92,6 +92,15 @@ class Goals(FormationCollection): endpoint = "goal-templates" +class Program(FormationResource): + endpoint = "programs" + + +class Programs(FormationCollection): + resource = Program + endpoint = "programs" + + class Formation(Target): Assessment = Assessment Assessments = Assessments @@ -104,6 +113,8 @@ class Formation(Target): Encounters = Encounters Goal = Goal Goals = Goals + Program = Program + Programs = Programs def __init__(self, version: Union[int, str] = "current"): super().__init__() diff --git a/welkin/models/patient.py b/welkin/models/patient.py index fea6592..a565e91 100644 --- a/welkin/models/patient.py +++ b/welkin/models/patient.py @@ -10,6 +10,7 @@ ) from welkin.models.email import Email, Emails from welkin.models.encounter import Encounter, Encounters +from welkin.models.program import PatientProgram, PatientPrograms from welkin.models.sms import SMS, SMSes from welkin.pagination import PageableIterator @@ -30,6 +31,8 @@ class Patient(Resource): Emails, Encounter, Encounters, + PatientProgram, + PatientPrograms, SearchChats, SMS, SMSes, @@ -38,8 +41,28 @@ class Patient(Resource): def create(self): return super().post(f"{self._client.instance}/patients") - def get(self): - return super().get(f"{self._client.instance}/patients/{self.id}") + def get(self, expand: bool = None): + _id = None + if hasattr(self, "id"): + type = None + _id = self.id + elif hasattr(self, "externalId"): + type = "EID" + _id = self.externalId + elif hasattr(self, "externalGuid"): + type = "EGUID" + _id = self.externalGuid + elif hasattr(self, "mrn"): + type = "MRN" + _id = self.mrn + + return super().get( + f"{self._client.instance}/patients/{_id}", + params={ + "type": type, + expand: expand, + }, + ) def update(self, **kwargs): return super().patch(f"{self._client.instance}/patients/{self.id}", kwargs) diff --git a/welkin/models/program.py b/welkin/models/program.py new file mode 100644 index 0000000..d451d56 --- /dev/null +++ b/welkin/models/program.py @@ -0,0 +1,85 @@ +from welkin.models.base import Collection, Resource +from welkin.pagination import MetaInfoIterator +from welkin.util import model_id + + +class ProgramPhase(Resource): + pass + + +class ProgramPhases(Collection): + resource = ProgramPhase + + +class PatientProgram(Resource): + subresources = [ProgramPhase] + nested_objects = { + "phases": "ProgramPhase", + "currentPhase": "ProgramPhase", + "pathHistory": "ProgramPhases", + } + + @model_id("Patient") + def get( + self, + patient_id: str, + assigned_programs: bool = None, + sort: str = None, + *args, + **kwargs, + ): + path = f"{self._client.instance}/patients/{patient_id}/programs" + if hasattr(self, "id"): + path += f"/history/{self.id}" + elif hasattr(self, "programName"): + path += f"/current/{self.programName}" + else: + raise ValueError("Program must have either programName or id attributes") + + return super().get( + path, + params={ + "assignedPrograms": assigned_programs, + "sort": sort, + }, + *args, + **kwargs, + ) + + @model_id("Patient") + def update(self, patient_id: str, **kwargs): + return super().patch( + f"{self._client.instance}/patients/{patient_id}/programs/" + f"{self.programName}", + kwargs, + ) + + @model_id("Patient") + def delete(self, patient_id: str): + return super().delete( + f"{self._client.instance}/patients/{patient_id}/programs/{self.id}" + ) + + +class PatientPrograms(Collection): + resource = PatientProgram + iterator = MetaInfoIterator + + @model_id("Patient") + def get( + self, + patient_id: str, + assigned_programs: bool = None, + sort: str = None, + *args, + **kwargs, + ): + return super().get( + f"{self._client.instance}/patients/{patient_id}/programs", + params={ + "assignedPrograms": assigned_programs, + "sort": sort, + }, + *args, + **kwargs, + ) diff --git a/welkin/models/sms.py b/welkin/models/sms.py index 5551ab8..6a23546 100644 --- a/welkin/models/sms.py +++ b/welkin/models/sms.py @@ -19,7 +19,6 @@ class SMSes(Collection): @model_id("Patient") def get(self, patient_id: str, sort: str = None, *args, **kwargs): - params = { "sort": sort, }