From 210e9564f4ae3cffefacefe9a443b2cdf986f149 Mon Sep 17 00:00:00 2001 From: Jack Plowman <62281988+JackPlowman@users.noreply.github.com> Date: Thu, 16 May 2024 14:45:26 +0100 Subject: [PATCH 1/7] NPA-2676 Add QuestionnaireResponse Sandbox response --- sandbox/api/app.py | 32 +++++++++++++++---- .../questionnaire_response_success.json | 17 ++++++++++ sandbox/api/utils.py | 4 +++ 3 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 sandbox/api/responses/POST_QuestionnaireResponse/questionnaire_response_success.json diff --git a/sandbox/api/app.py b/sandbox/api/app.py index c286c4b..b3440f8 100644 --- a/sandbox/api/app.py +++ b/sandbox/api/app.py @@ -4,17 +4,18 @@ from flask import Flask, request from .utils import ( + ERROR_RESPONSE, + LIST_RELATIONSHIP, + LIST_RELATIONSHIP_INCLUDE, + QUESTIONNAIRE_RESPONSE_SUCCESS, VALIDATE_RELATIONSHIP_009, - VALIDATE_RELATIONSHIP_INCLUDE_009, VALIDATE_RELATIONSHIP_025, + VALIDATE_RELATIONSHIP_INCLUDE_009, VALIDATE_RELATIONSHIP_INCLUDE_025, - LIST_RELATIONSHIP, - LIST_RELATIONSHIP_INCLUDE, - ERROR_RESPONSE, - check_for_errors, check_for_empty, - check_for_validate, + check_for_errors, check_for_list, + check_for_validate, generate_response, load_json_file, ) @@ -22,6 +23,7 @@ app = Flask(__name__) basicConfig(level=INFO, format="%(asctime)s - %(message)s") logger = getLogger(__name__) +COMMON_PATH = "FHIR/R4" @app.route("/_status", methods=["GET"]) @@ -35,7 +37,7 @@ def health() -> dict: } -@app.route("/FHIR/R4/RelatedPerson", methods=["GET"]) +@app.route(f"/{COMMON_PATH}/RelatedPerson", methods=["GET"]) def get_related_persons() -> Union[dict, tuple]: """Sandbox API for GET /RelatedPerson @@ -90,3 +92,19 @@ def get_related_persons() -> Union[dict, tuple]: except Exception as e: logger.error(e) return generate_response(load_json_file(ERROR_RESPONSE), 500) + + +@app.route(f"/{COMMON_PATH}/QuestionnaireResponse", methods=["POST"]) +def post_questionnaire_response() -> Union[dict, tuple]: + """Sandbox API for POST /QuestionnaireResponse + + Returns: + Union[dict, tuple]: Response for POST /QuestionnaireResponse + """ + + try: + generate_response(load_json_file(QUESTIONNAIRE_RESPONSE_SUCCESS), 200) + + except Exception as e: + logger.error(e) + return generate_response(load_json_file(ERROR_RESPONSE), 500) diff --git a/sandbox/api/responses/POST_QuestionnaireResponse/questionnaire_response_success.json b/sandbox/api/responses/POST_QuestionnaireResponse/questionnaire_response_success.json new file mode 100644 index 0000000..7d70513 --- /dev/null +++ b/sandbox/api/responses/POST_QuestionnaireResponse/questionnaire_response_success.json @@ -0,0 +1,17 @@ +{ + "resourceType": "OperationOutcome", + "issue": [ + { + "severity": "information", + "code": "informational", + "details": { + "coding": [ + { + "code": "HDJ2123F", + "display": "HDJ2123F" + } + ] + } + } + ] +} diff --git a/sandbox/api/utils.py b/sandbox/api/utils.py index 36e223c..c567198 100644 --- a/sandbox/api/utils.py +++ b/sandbox/api/utils.py @@ -26,6 +26,10 @@ ERROR_RESPONSE = "./api/responses/internal_server_error.json" INCLUDE_FLAG = "RelatedPerson:patient" +QUESTIONNAIRE_RESPONSE_SUCCESS = ( + "./api/responses/POST_QuestionnaireResponse/questionnaire_response_success.json" +) + PATIENT_IDENTIFIERS = ["9000000017", "9000000033"] RELATED_IDENTIFIERS = ["9000000009", "9000000025"] From 90677ee1cfad91c110b03da5df0717d99368bfe4 Mon Sep 17 00:00:00 2001 From: Jack Plowman <62281988+JackPlowman@users.noreply.github.com> Date: Thu, 16 May 2024 17:25:19 +0100 Subject: [PATCH 2/7] NPA-2676 Update Postman collection --- ...ip Service Sandbox.postman_collection.json | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index c0d6c7a..6662f2a 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -1,10 +1,10 @@ { "info": { - "_postman_id": "a7ded7b6-5327-41f5-bf02-dcfe56d258c8", + "_postman_id": "baa50c46-c6a2-4203-89ed-fa97e9afc872", "name": "Validate Relationship Service Sandbox", "description": "Example usage of the Validate Relationship Service (VRS) sandbox.\n\nFull specification is available at [https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service)", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "21394218" + "_exporter_id": "34042403" }, "item": [ { @@ -202,6 +202,43 @@ } ], "description": "Examples of how to utilise the API to list relationships for a given NHS record." + }, + { + "name": "Questionnaire Response", + "item": [] + }, + { + "name": "Questionnaire Response", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/fhir+json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-03-24T16:32:12.363Z\",\n \"source\": { \n \"type\": \"RelatedPerson\",\n \"identifier\": \"9000000001\" \n },\n \"item\": [\n {\n \"linkId\": \"proxy_details\",\n \"text\": \"Proxy details\",\n \"item\": [\n {\n \"linkId\": \"nhs_number\",\n \"text\": \"NHS Number\",\n \"answer\": [ \n {\n \"valueString\": \"9000000001\"\n }\n ]\n },\n {\n \"linkId\": \"relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"PRN\",\n \"display\": \"Parent\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient_details\",\n \"text\": \"Patient details\",\n \"item\": [\n {\n \"linkId\": \"nhs_number\",\n \"text\": \"NHS Number\",\n \"answer\": [\n {\n \"valueString\": \"9000000002\"\n }\n ]\n },\n {\n \"linkId\": \"first_name\",\n \"text\": \"First Name\",\n \"answer\": [\n {\n \"valueString\": \"Timmy\"\n }\n ]\n },\n {\n \"linkId\": \"last_name\",\n \"text\": \"Last name\",\n \"answer\": [\n {\n \"valueString\": \"Tenenbaum\"\n }\n ]\n },\n {\n \"linkId\": \"date_of_birth\",\n \"text\": \"Date of Birth\",\n \"answer\": [\n {\n \"valueDate\": \"2020-10-22\"\n }\n ]\n },\n {\n \"linkId\": \"postcode\",\n \"text\": \"Postcode\",\n \"answer\": [\n {\n \"valueString\": \"LS1 4AP\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requested_services\",\n \"text\": \"Requested services\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"appointments\",\n \"display\": \"manage appointments\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"medicines\",\n \"display\": \"manage medicines\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"records\",\n \"display\": \"access medical records\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"demographics\",\n \"display\": \"manage demographics and contact details\"\n }\n }\n ]\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{api_base_url}}/QuestionnaireResponse", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ] + }, + "description": "Example of a response where the given NHS numbers do not have a relationship." + }, + "response": [] } ], "event": [ @@ -231,4 +268,4 @@ "type": "string" } ] -} \ No newline at end of file +} From 111cee9aeba6103d9dceae6172c3299c2c21c628 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 May 2024 15:40:38 +0000 Subject: [PATCH 3/7] NPA-2676: pip (deps-dev): bump the python-dependencies group across 1 directory with 3 updates Bumps the python-dependencies group with 3 updates in the / directory: [pip-licenses](https://github.com/raimon49/pip-licenses), [semver](https://github.com/python-semver/python-semver) and [coverage](https://github.com/nedbat/coveragepy). Updates `pip-licenses` from 2.3.0 to 4.4.0 - [Release notes](https://github.com/raimon49/pip-licenses/releases) - [Changelog](https://github.com/raimon49/pip-licenses/blob/master/CHANGELOG.md) - [Commits](https://github.com/raimon49/pip-licenses/compare/v-2.3.0...v-4.4.0) Updates `semver` from 2.13.0 to 3.0.2 - [Release notes](https://github.com/python-semver/python-semver/releases) - [Changelog](https://github.com/python-semver/python-semver/blob/master/CHANGELOG.rst) - [Commits](https://github.com/python-semver/python-semver/compare/2.13.0...3.0.2) Updates `coverage` from 5.5 to 7.5.1 - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.5...7.5.1) --- updated-dependencies: - dependency-name: pip-licenses dependency-type: direct:development update-type: version-update:semver-major dependency-group: python-dependencies - dependency-name: semver dependency-type: direct:development update-type: version-update:semver-major dependency-group: python-dependencies - dependency-name: coverage dependency-type: direct:development update-type: version-update:semver-major dependency-group: python-dependencies ... Signed-off-by: dependabot[bot] --- poetry.lock | 160 +++++++++++++++++++++++++++---------------------- pyproject.toml | 6 +- 2 files changed, 92 insertions(+), 74 deletions(-) diff --git a/poetry.lock b/poetry.lock index 94f5b11..f5fca55 100644 --- a/poetry.lock +++ b/poetry.lock @@ -404,67 +404,67 @@ files = [ [[package]] name = "coverage" -version = "5.5" +version = "7.5.1" description = "Code coverage measurement for Python" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" +python-versions = ">=3.8" files = [ - {file = "coverage-5.5-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf"}, - {file = "coverage-5.5-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:b7895207b4c843c76a25ab8c1e866261bcfe27bfaa20c192de5190121770672b"}, - {file = "coverage-5.5-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:c2723d347ab06e7ddad1a58b2a821218239249a9e4365eaff6649d31180c1669"}, - {file = "coverage-5.5-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:900fbf7759501bc7807fd6638c947d7a831fc9fdf742dc10f02956ff7220fa90"}, - {file = "coverage-5.5-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:004d1880bed2d97151facef49f08e255a20ceb6f9432df75f4eef018fdd5a78c"}, - {file = "coverage-5.5-cp27-cp27m-win32.whl", hash = "sha256:06191eb60f8d8a5bc046f3799f8a07a2d7aefb9504b0209aff0b47298333302a"}, - {file = "coverage-5.5-cp27-cp27m-win_amd64.whl", hash = "sha256:7501140f755b725495941b43347ba8a2777407fc7f250d4f5a7d2a1050ba8e82"}, - {file = "coverage-5.5-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:372da284cfd642d8e08ef606917846fa2ee350f64994bebfbd3afb0040436905"}, - {file = "coverage-5.5-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:8963a499849a1fc54b35b1c9f162f4108017b2e6db2c46c1bed93a72262ed083"}, - {file = "coverage-5.5-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:869a64f53488f40fa5b5b9dcb9e9b2962a66a87dab37790f3fcfb5144b996ef5"}, - {file = "coverage-5.5-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:4a7697d8cb0f27399b0e393c0b90f0f1e40c82023ea4d45d22bce7032a5d7b81"}, - {file = "coverage-5.5-cp310-cp310-macosx_10_14_x86_64.whl", hash = "sha256:8d0a0725ad7c1a0bcd8d1b437e191107d457e2ec1084b9f190630a4fb1af78e6"}, - {file = "coverage-5.5-cp310-cp310-manylinux1_x86_64.whl", hash = "sha256:51cb9476a3987c8967ebab3f0fe144819781fca264f57f89760037a2ea191cb0"}, - {file = "coverage-5.5-cp310-cp310-win_amd64.whl", hash = "sha256:c0891a6a97b09c1f3e073a890514d5012eb256845c451bd48f7968ef939bf4ae"}, - {file = "coverage-5.5-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:3487286bc29a5aa4b93a072e9592f22254291ce96a9fbc5251f566b6b7343cdb"}, - {file = "coverage-5.5-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:deee1077aae10d8fa88cb02c845cfba9b62c55e1183f52f6ae6a2df6a2187160"}, - {file = "coverage-5.5-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6"}, - {file = "coverage-5.5-cp35-cp35m-manylinux2010_i686.whl", hash = "sha256:6c90e11318f0d3c436a42409f2749ee1a115cd8b067d7f14c148f1ce5574d701"}, - {file = "coverage-5.5-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:30c77c1dc9f253283e34c27935fded5015f7d1abe83bc7821680ac444eaf7793"}, - {file = "coverage-5.5-cp35-cp35m-win32.whl", hash = "sha256:9a1ef3b66e38ef8618ce5fdc7bea3d9f45f3624e2a66295eea5e57966c85909e"}, - {file = "coverage-5.5-cp35-cp35m-win_amd64.whl", hash = "sha256:972c85d205b51e30e59525694670de6a8a89691186012535f9d7dbaa230e42c3"}, - {file = "coverage-5.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:af0e781009aaf59e25c5a678122391cb0f345ac0ec272c7961dc5455e1c40066"}, - {file = "coverage-5.5-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:74d881fc777ebb11c63736622b60cb9e4aee5cace591ce274fb69e582a12a61a"}, - {file = "coverage-5.5-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:92b017ce34b68a7d67bd6d117e6d443a9bf63a2ecf8567bb3d8c6c7bc5014465"}, - {file = "coverage-5.5-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:d636598c8305e1f90b439dbf4f66437de4a5e3c31fdf47ad29542478c8508bbb"}, - {file = "coverage-5.5-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:41179b8a845742d1eb60449bdb2992196e211341818565abded11cfa90efb821"}, - {file = "coverage-5.5-cp36-cp36m-win32.whl", hash = "sha256:040af6c32813fa3eae5305d53f18875bedd079960822ef8ec067a66dd8afcd45"}, - {file = "coverage-5.5-cp36-cp36m-win_amd64.whl", hash = "sha256:5fec2d43a2cc6965edc0bb9e83e1e4b557f76f843a77a2496cbe719583ce8184"}, - {file = "coverage-5.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:18ba8bbede96a2c3dde7b868de9dcbd55670690af0988713f0603f037848418a"}, - {file = "coverage-5.5-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:2910f4d36a6a9b4214bb7038d537f015346f413a975d57ca6b43bf23d6563b53"}, - {file = "coverage-5.5-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:f0b278ce10936db1a37e6954e15a3730bea96a0997c26d7fee88e6c396c2086d"}, - {file = "coverage-5.5-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:796c9c3c79747146ebd278dbe1e5c5c05dd6b10cc3bcb8389dfdf844f3ead638"}, - {file = "coverage-5.5-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:53194af30d5bad77fcba80e23a1441c71abfb3e01192034f8246e0d8f99528f3"}, - {file = "coverage-5.5-cp37-cp37m-win32.whl", hash = "sha256:184a47bbe0aa6400ed2d41d8e9ed868b8205046518c52464fde713ea06e3a74a"}, - {file = "coverage-5.5-cp37-cp37m-win_amd64.whl", hash = "sha256:2949cad1c5208b8298d5686d5a85b66aae46d73eec2c3e08c817dd3513e5848a"}, - {file = "coverage-5.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:217658ec7187497e3f3ebd901afdca1af062b42cfe3e0dafea4cced3983739f6"}, - {file = "coverage-5.5-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1aa846f56c3d49205c952d8318e76ccc2ae23303351d9270ab220004c580cfe2"}, - {file = "coverage-5.5-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:24d4a7de75446be83244eabbff746d66b9240ae020ced65d060815fac3423759"}, - {file = "coverage-5.5-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1f8bf7b90ba55699b3a5e44930e93ff0189aa27186e96071fac7dd0d06a1873"}, - {file = "coverage-5.5-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:970284a88b99673ccb2e4e334cfb38a10aab7cd44f7457564d11898a74b62d0a"}, - {file = "coverage-5.5-cp38-cp38-win32.whl", hash = "sha256:01d84219b5cdbfc8122223b39a954820929497a1cb1422824bb86b07b74594b6"}, - {file = "coverage-5.5-cp38-cp38-win_amd64.whl", hash = "sha256:2e0d881ad471768bf6e6c2bf905d183543f10098e3b3640fc029509530091502"}, - {file = "coverage-5.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d1f9ce122f83b2305592c11d64f181b87153fc2c2bbd3bb4a3dde8303cfb1a6b"}, - {file = "coverage-5.5-cp39-cp39-manylinux1_i686.whl", hash = "sha256:13c4ee887eca0f4c5a247b75398d4114c37882658300e153113dafb1d76de529"}, - {file = "coverage-5.5-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:52596d3d0e8bdf3af43db3e9ba8dcdaac724ba7b5ca3f6358529d56f7a166f8b"}, - {file = "coverage-5.5-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:2cafbbb3af0733db200c9b5f798d18953b1a304d3f86a938367de1567f4b5bff"}, - {file = "coverage-5.5-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:44d654437b8ddd9eee7d1eaee28b7219bec228520ff809af170488fd2fed3e2b"}, - {file = "coverage-5.5-cp39-cp39-win32.whl", hash = "sha256:d314ed732c25d29775e84a960c3c60808b682c08d86602ec2c3008e1202e3bb6"}, - {file = "coverage-5.5-cp39-cp39-win_amd64.whl", hash = "sha256:13034c4409db851670bc9acd836243aeee299949bd5673e11844befcb0149f03"}, - {file = "coverage-5.5-pp36-none-any.whl", hash = "sha256:f030f8873312a16414c0d8e1a1ddff2d3235655a2174e3648b4fa66b3f2f1079"}, - {file = "coverage-5.5-pp37-none-any.whl", hash = "sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4"}, - {file = "coverage-5.5.tar.gz", hash = "sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c"}, + {file = "coverage-7.5.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c0884920835a033b78d1c73b6d3bbcda8161a900f38a488829a83982925f6c2e"}, + {file = "coverage-7.5.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:39afcd3d4339329c5f58de48a52f6e4e50f6578dd6099961cf22228feb25f38f"}, + {file = "coverage-7.5.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4a7b0ceee8147444347da6a66be737c9d78f3353b0681715b668b72e79203e4a"}, + {file = "coverage-7.5.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a9ca3f2fae0088c3c71d743d85404cec8df9be818a005ea065495bedc33da35"}, + {file = "coverage-7.5.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fd215c0c7d7aab005221608a3c2b46f58c0285a819565887ee0b718c052aa4e"}, + {file = "coverage-7.5.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4bf0655ab60d754491004a5efd7f9cccefcc1081a74c9ef2da4735d6ee4a6223"}, + {file = "coverage-7.5.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:61c4bf1ba021817de12b813338c9be9f0ad5b1e781b9b340a6d29fc13e7c1b5e"}, + {file = "coverage-7.5.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:db66fc317a046556a96b453a58eced5024af4582a8dbdc0c23ca4dbc0d5b3146"}, + {file = "coverage-7.5.1-cp310-cp310-win32.whl", hash = "sha256:b016ea6b959d3b9556cb401c55a37547135a587db0115635a443b2ce8f1c7228"}, + {file = "coverage-7.5.1-cp310-cp310-win_amd64.whl", hash = "sha256:df4e745a81c110e7446b1cc8131bf986157770fa405fe90e15e850aaf7619bc8"}, + {file = "coverage-7.5.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:796a79f63eca8814ca3317a1ea443645c9ff0d18b188de470ed7ccd45ae79428"}, + {file = "coverage-7.5.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4fc84a37bfd98db31beae3c2748811a3fa72bf2007ff7902f68746d9757f3746"}, + {file = "coverage-7.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6175d1a0559986c6ee3f7fccfc4a90ecd12ba0a383dcc2da30c2b9918d67d8a3"}, + {file = "coverage-7.5.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1fc81d5878cd6274ce971e0a3a18a8803c3fe25457165314271cf78e3aae3aa2"}, + {file = "coverage-7.5.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:556cf1a7cbc8028cb60e1ff0be806be2eded2daf8129b8811c63e2b9a6c43bca"}, + {file = "coverage-7.5.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:9981706d300c18d8b220995ad22627647be11a4276721c10911e0e9fa44c83e8"}, + {file = "coverage-7.5.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:d7fed867ee50edf1a0b4a11e8e5d0895150e572af1cd6d315d557758bfa9c057"}, + {file = "coverage-7.5.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ef48e2707fb320c8f139424a596f5b69955a85b178f15af261bab871873bb987"}, + {file = "coverage-7.5.1-cp311-cp311-win32.whl", hash = "sha256:9314d5678dcc665330df5b69c1e726a0e49b27df0461c08ca12674bcc19ef136"}, + {file = "coverage-7.5.1-cp311-cp311-win_amd64.whl", hash = "sha256:5fa567e99765fe98f4e7d7394ce623e794d7cabb170f2ca2ac5a4174437e90dd"}, + {file = "coverage-7.5.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:b6cf3764c030e5338e7f61f95bd21147963cf6aa16e09d2f74f1fa52013c1206"}, + {file = "coverage-7.5.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2ec92012fefebee89a6b9c79bc39051a6cb3891d562b9270ab10ecfdadbc0c34"}, + {file = "coverage-7.5.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:16db7f26000a07efcf6aea00316f6ac57e7d9a96501e990a36f40c965ec7a95d"}, + {file = "coverage-7.5.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:beccf7b8a10b09c4ae543582c1319c6df47d78fd732f854ac68d518ee1fb97fa"}, + {file = "coverage-7.5.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8748731ad392d736cc9ccac03c9845b13bb07d020a33423fa5b3a36521ac6e4e"}, + {file = "coverage-7.5.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7352b9161b33fd0b643ccd1f21f3a3908daaddf414f1c6cb9d3a2fd618bf2572"}, + {file = "coverage-7.5.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:7a588d39e0925f6a2bff87154752481273cdb1736270642aeb3635cb9b4cad07"}, + {file = "coverage-7.5.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:68f962d9b72ce69ea8621f57551b2fa9c70509af757ee3b8105d4f51b92b41a7"}, + {file = "coverage-7.5.1-cp312-cp312-win32.whl", hash = "sha256:f152cbf5b88aaeb836127d920dd0f5e7edff5a66f10c079157306c4343d86c19"}, + {file = "coverage-7.5.1-cp312-cp312-win_amd64.whl", hash = "sha256:5a5740d1fb60ddf268a3811bcd353de34eb56dc24e8f52a7f05ee513b2d4f596"}, + {file = "coverage-7.5.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:e2213def81a50519d7cc56ed643c9e93e0247f5bbe0d1247d15fa520814a7cd7"}, + {file = "coverage-7.5.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:5037f8fcc2a95b1f0e80585bd9d1ec31068a9bcb157d9750a172836e98bc7a90"}, + {file = "coverage-7.5.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c3721c2c9e4c4953a41a26c14f4cef64330392a6d2d675c8b1db3b645e31f0e"}, + {file = "coverage-7.5.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca498687ca46a62ae590253fba634a1fe9836bc56f626852fb2720f334c9e4e5"}, + {file = "coverage-7.5.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0cdcbc320b14c3e5877ee79e649677cb7d89ef588852e9583e6b24c2e5072661"}, + {file = "coverage-7.5.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:57e0204b5b745594e5bc14b9b50006da722827f0b8c776949f1135677e88d0b8"}, + {file = "coverage-7.5.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:8fe7502616b67b234482c3ce276ff26f39ffe88adca2acf0261df4b8454668b4"}, + {file = "coverage-7.5.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:9e78295f4144f9dacfed4f92935fbe1780021247c2fabf73a819b17f0ccfff8d"}, + {file = "coverage-7.5.1-cp38-cp38-win32.whl", hash = "sha256:1434e088b41594baa71188a17533083eabf5609e8e72f16ce8c186001e6b8c41"}, + {file = "coverage-7.5.1-cp38-cp38-win_amd64.whl", hash = "sha256:0646599e9b139988b63704d704af8e8df7fa4cbc4a1f33df69d97f36cb0a38de"}, + {file = "coverage-7.5.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4cc37def103a2725bc672f84bd939a6fe4522310503207aae4d56351644682f1"}, + {file = "coverage-7.5.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:fc0b4d8bfeabd25ea75e94632f5b6e047eef8adaed0c2161ada1e922e7f7cece"}, + {file = "coverage-7.5.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d0a0f5e06881ecedfe6f3dd2f56dcb057b6dbeb3327fd32d4b12854df36bf26"}, + {file = "coverage-7.5.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9735317685ba6ec7e3754798c8871c2f49aa5e687cc794a0b1d284b2389d1bd5"}, + {file = "coverage-7.5.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d21918e9ef11edf36764b93101e2ae8cc82aa5efdc7c5a4e9c6c35a48496d601"}, + {file = "coverage-7.5.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:c3e757949f268364b96ca894b4c342b41dc6f8f8b66c37878aacef5930db61be"}, + {file = "coverage-7.5.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:79afb6197e2f7f60c4824dd4b2d4c2ec5801ceb6ba9ce5d2c3080e5660d51a4f"}, + {file = "coverage-7.5.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:d1d0d98d95dd18fe29dc66808e1accf59f037d5716f86a501fc0256455219668"}, + {file = "coverage-7.5.1-cp39-cp39-win32.whl", hash = "sha256:1cc0fe9b0b3a8364093c53b0b4c0c2dd4bb23acbec4c9240b5f284095ccf7981"}, + {file = "coverage-7.5.1-cp39-cp39-win_amd64.whl", hash = "sha256:dde0070c40ea8bb3641e811c1cfbf18e265d024deff6de52c5950677a8fb1e0f"}, + {file = "coverage-7.5.1-pp38.pp39.pp310-none-any.whl", hash = "sha256:6537e7c10cc47c595828b8a8be04c72144725c383c4702703ff4e42e44577312"}, + {file = "coverage-7.5.1.tar.gz", hash = "sha256:54de9ef3a9da981f7af93eafde4ede199e0846cd819eb27c88e2b712aae9708c"}, ] [package.extras] -toml = ["toml"] +toml = ["tomli"] [[package]] name = "cryptography" @@ -1065,20 +1065,20 @@ files = [ [[package]] name = "pip-licenses" -version = "2.3.0" +version = "4.4.0" description = "Dump the software license list of Python packages installed with pip." optional = false -python-versions = "~=3.5" +python-versions = "~=3.8" files = [ - {file = "pip-licenses-2.3.0.tar.gz", hash = "sha256:630f7e1b51ac0751c9c218e2ed76bb982e769301510a0bcca0dd4a47d05198fd"}, - {file = "pip_licenses-2.3.0-py3-none-any.whl", hash = "sha256:b3922fc71e819c1a155460116d2fcf15eca85a22ebe057cd1e1dedb951b1199f"}, + {file = "pip-licenses-4.4.0.tar.gz", hash = "sha256:996817118375445243a34faafe23c06f6b2d250247c4046571b5a6722d45be69"}, + {file = "pip_licenses-4.4.0-py3-none-any.whl", hash = "sha256:dbad2ac5a25f574cabe2716f2f031a0c5fa359bed9b3ef615301f4e546893b46"}, ] [package.dependencies] -PTable = "*" +prettytable = ">=2.3.0" [package.extras] -test = ["docutils", "pytest-cov", "pytest-pycodestyle", "pytest-runner"] +test = ["docutils", "mypy", "pytest-cov", "pytest-pycodestyle", "pytest-runner"] [[package]] name = "platformdirs" @@ -1123,15 +1123,22 @@ files = [ ] [[package]] -name = "ptable" -version = "0.9.2" +name = "prettytable" +version = "3.10.0" description = "A simple Python library for easily displaying tabular data in a visually appealing ASCII table format" optional = false -python-versions = "*" +python-versions = ">=3.8" files = [ - {file = "PTable-0.9.2.tar.gz", hash = "sha256:aa7fc151cb40f2dabcd2275ba6f7fd0ff8577a86be3365cd3fb297cbe09cc292"}, + {file = "prettytable-3.10.0-py3-none-any.whl", hash = "sha256:6536efaf0757fdaa7d22e78b3aac3b69ea1b7200538c2c6995d649365bddab92"}, + {file = "prettytable-3.10.0.tar.gz", hash = "sha256:9665594d137fb08a1117518c25551e0ede1687197cf353a4fdc78d27e1073568"}, ] +[package.dependencies] +wcwidth = "*" + +[package.extras] +tests = ["pytest", "pytest-cov", "pytest-lazy-fixtures"] + [[package]] name = "pycodestyle" version = "2.7.0" @@ -1436,13 +1443,13 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "semver" -version = "2.13.0" -description = "Python helper for Semantic Versioning (http://semver.org/)" +version = "3.0.2" +description = "Python helper for Semantic Versioning (https://semver.org)" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.7" files = [ - {file = "semver-2.13.0-py2.py3-none-any.whl", hash = "sha256:ced8b23dceb22134307c1b8abfa523da14198793d9787ac838e70e29e77458d4"}, - {file = "semver-2.13.0.tar.gz", hash = "sha256:fa0fe2722ee1c3f57eac478820c3a5ae2f624af8264cbdf9000c980ff7f75e3f"}, + {file = "semver-3.0.2-py3-none-any.whl", hash = "sha256:b1ea4686fe70b981f85359eda33199d60c53964284e0cfb4977d243e37cf4bf4"}, + {file = "semver-3.0.2.tar.gz", hash = "sha256:6253adb39c70f6e51afed2fa7152bcd414c411286088fb4b9effb133885ab4cc"}, ] [[package]] @@ -1517,6 +1524,17 @@ h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] +[[package]] +name = "wcwidth" +version = "0.2.13" +description = "Measures the displayed width of unicode strings in a terminal" +optional = false +python-versions = "*" +files = [ + {file = "wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859"}, + {file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"}, +] + [[package]] name = "wheel" version = "0.38.4" @@ -1637,4 +1655,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "61cbcf8f7a6d71e31d15e9700687c8e57fa59b5ea94fd495414736774ea0fc13" +content-hash = "5880b3fd847f413db3cd698cabf23f71a19484b63fdf3da96100c4fee33df29f" diff --git a/pyproject.toml b/pyproject.toml index fbc63e5..0163697 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,14 +24,14 @@ pytest-nhsd-apim = "^3.3.2" [tool.poetry.dev-dependencies] flake8 = "^3.7.9" black = "^24.3.0" -pip-licenses = "^2.0.1" +pip-licenses = "^4.4.0" jinja2 = "^3.1.3" pyyaml = "^6.0.1" docopt = "^0.6.2" jsonpath-rw = "^1.4.0" -semver = "^2.9.0" +semver = "^3.0.2" gitpython = "^3.0.5" pytest = "^8.2.0" -coverage = "^5.5" +coverage = "^7.5" aiohttp = "^3.7.3" pytest-asyncio = "^0.14.0" From 9799782fdd0f3f2044a085bc481d0e4aaffe8754 Mon Sep 17 00:00:00 2001 From: Jack Plowman <62281988+JackPlowman@users.noreply.github.com> Date: Fri, 17 May 2024 13:10:35 +0100 Subject: [PATCH 4/7] NPA-2676 Update sandbox unit tests --- sandbox/api/app.py | 3 +- .../bad_request_identifier_missing.json | 3 +- ...ad_request_identifier_not_as_expected.json | 3 +- .../{GET_RelatedPerson => }/not_found.json | 0 sandbox/api/tests/conftest.py | 1 + sandbox/api/tests/test_app.py | 46 +++++++++++++++---- sandbox/api/utils.py | 2 +- 7 files changed, 43 insertions(+), 15 deletions(-) rename sandbox/api/responses/{GET_RelatedPerson => }/not_found.json (100%) diff --git a/sandbox/api/app.py b/sandbox/api/app.py index b3440f8..98d9c43 100644 --- a/sandbox/api/app.py +++ b/sandbox/api/app.py @@ -103,8 +103,7 @@ def post_questionnaire_response() -> Union[dict, tuple]: """ try: - generate_response(load_json_file(QUESTIONNAIRE_RESPONSE_SUCCESS), 200) - + return generate_response(load_json_file(QUESTIONNAIRE_RESPONSE_SUCCESS), 200) except Exception as e: logger.error(e) return generate_response(load_json_file(ERROR_RESPONSE), 500) diff --git a/sandbox/api/responses/GET_RelatedPerson/bad_request_identifier_missing.json b/sandbox/api/responses/GET_RelatedPerson/bad_request_identifier_missing.json index 5e44627..5f5a470 100644 --- a/sandbox/api/responses/GET_RelatedPerson/bad_request_identifier_missing.json +++ b/sandbox/api/responses/GET_RelatedPerson/bad_request_identifier_missing.json @@ -14,8 +14,7 @@ ] }, "diagnostics": "The 'identifier' parameter is required", - "severity": "error", - "expression": ["RelatedPerson.identifier"] + "severity": "error" } ], "resourceType": "OperationOutcome" diff --git a/sandbox/api/responses/GET_RelatedPerson/bad_request_identifier_not_as_expected.json b/sandbox/api/responses/GET_RelatedPerson/bad_request_identifier_not_as_expected.json index 4ddc209..5509dc7 100644 --- a/sandbox/api/responses/GET_RelatedPerson/bad_request_identifier_not_as_expected.json +++ b/sandbox/api/responses/GET_RelatedPerson/bad_request_identifier_not_as_expected.json @@ -13,8 +13,7 @@ ] }, "diagnostics": "The identifier system is not valid.", - "severity": "error", - "expression": ["identifier"] + "severity": "error" } ], "resourceType": "OperationOutcome" diff --git a/sandbox/api/responses/GET_RelatedPerson/not_found.json b/sandbox/api/responses/not_found.json similarity index 100% rename from sandbox/api/responses/GET_RelatedPerson/not_found.json rename to sandbox/api/responses/not_found.json diff --git a/sandbox/api/tests/conftest.py b/sandbox/api/tests/conftest.py index 0c82cdd..97b0dfe 100644 --- a/sandbox/api/tests/conftest.py +++ b/sandbox/api/tests/conftest.py @@ -3,6 +3,7 @@ from ..app import app RELATED_PERSON_API_ENDPOINT = "/FHIR/R4/RelatedPerson" +QUESTIONNAIRE_RESPONSE_API_ENDPOINT = "/FHIR/R4/QuestionnaireResponse" @pytest.fixture() diff --git a/sandbox/api/tests/test_app.py b/sandbox/api/tests/test_app.py index e4a5651..77517fc 100644 --- a/sandbox/api/tests/test_app.py +++ b/sandbox/api/tests/test_app.py @@ -2,9 +2,10 @@ import pytest -from .conftest import RELATED_PERSON_API_ENDPOINT +from .conftest import RELATED_PERSON_API_ENDPOINT, QUESTIONNAIRE_RESPONSE_API_ENDPOINT -FILE_PATH = "sandbox.api.utils" +UTILS_FILE_PATH = "sandbox.api.utils" +APP_FILE_PATH = "sandbox.api.app" @pytest.mark.parametrize("endpoint", ["/_status", "/_ping", "/health"]) @@ -25,12 +26,12 @@ def test_health_check(client: object, endpoint: str) -> None: [ ( "identifier=9000000041", - "./api/responses/GET_RelatedPerson/not_found.json", + "./api/responses/not_found.json", 404, ), ( "identifier=9000000017&patient:identifier=9000000041", - "./api/responses/GET_RelatedPerson/not_found.json", + "./api/responses/not_found.json", 404, ), ( @@ -85,9 +86,9 @@ def test_health_check(client: object, endpoint: str) -> None: ), ], ) -@patch(f"{FILE_PATH}.load_json_file") +@patch(f"{UTILS_FILE_PATH}.load_json_file") def test_related_person( - mock_get_response: MagicMock, + mock_load_json_file: MagicMock, request_args: str, response_file_name: str, client: object, @@ -95,10 +96,39 @@ def test_related_person( ) -> None: """Test related_persons endpoint with identifier only.""" # Arrange - mock_get_response.return_value = expected_body = {"data": "mocked"} + mock_load_json_file.return_value = expected_body = {"data": "mocked"} # Act response = client.get(f"{RELATED_PERSON_API_ENDPOINT}?{request_args}") # Assert - mock_get_response.assert_called_once_with(response_file_name) + mock_load_json_file.assert_called_once_with(response_file_name) + assert response.status_code == status_code + assert response.json == expected_body + + +@pytest.mark.parametrize( + "url_path,response_file_name,status_code", + [ + ( + QUESTIONNAIRE_RESPONSE_API_ENDPOINT, + "./api/responses/POST_QuestionnaireResponse/questionnaire_response_success.json", + 200, + ), + ], +) +@patch(f"{APP_FILE_PATH}.load_json_file") +def test_questionnaire_response( + mock_load_json_file: MagicMock, + url_path: str, + response_file_name: str, + client: object, + status_code: int, +) -> None: + """Test related_persons endpoint with identifier only.""" + # Arrange + mock_load_json_file.return_value = expected_body = {"data": "mocked"} + # Act + response = client.post(url_path, json={"data": "mocked"}) + # Assert + mock_load_json_file.assert_called_once_with(response_file_name) assert response.status_code == status_code assert response.json == expected_body diff --git a/sandbox/api/utils.py b/sandbox/api/utils.py index c567198..5a30f3b 100644 --- a/sandbox/api/utils.py +++ b/sandbox/api/utils.py @@ -3,7 +3,7 @@ from flask import request, Response -NOT_FOUND = "./api/responses/GET_RelatedPerson/not_found.json" +NOT_FOUND = "./api/responses/not_found.json" EMPTY_RESPONSE = "./api/responses/GET_RelatedPerson/empty_response_9000000033.json" LIST_RELATIONSHIP = ( "./api/responses/GET_RelatedPerson/list_relationship_9000000017.json" From cdb567d83758222e6baea2a5e2821196a4fbd8d0 Mon Sep 17 00:00:00 2001 From: Jack Plowman <62281988+JackPlowman@users.noreply.github.com> Date: Fri, 17 May 2024 13:27:48 +0100 Subject: [PATCH 5/7] NPA-2676 Update spec with sandbox try it now comment --- specification/validated-relationships-service-api.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 2c40395..9ef5f55 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -158,6 +158,11 @@ paths: Proxy Access Service and submitted as a QuestionaireResponse. For the most part demographics information doesn't need to be provided in the access request since it can be pulled from PDS. + + ## Sandbox test scenarios + + For details of sandbox test scenarios, or to try out the sandbox using our 'Try it out' feature, see the documentation for each endpoint. + operationId: new-access-request parameters: - $ref: "#/components/parameters/BearerAuthorization" From 47a52e8ebca97cc761f53dabc6a0e23f6c1b3a17 Mon Sep 17 00:00:00 2001 From: Jack Plowman <62281988+JackPlowman@users.noreply.github.com> Date: Fri, 17 May 2024 13:30:37 +0100 Subject: [PATCH 6/7] NPA-2676 Fix Postman collection structure --- ...ip Service Sandbox.postman_collection.json | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index 6662f2a..ecfa702 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "baa50c46-c6a2-4203-89ed-fa97e9afc872", + "_postman_id": "85ee4695-8528-4e6e-82a6-29c4bea26a6d", "name": "Validate Relationship Service Sandbox", "description": "Example usage of the Validate Relationship Service (VRS) sandbox.\n\nFull specification is available at [https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service)", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", @@ -205,40 +205,40 @@ }, { "name": "Questionnaire Response", - "item": [] - }, - { - "name": "Questionnaire Response", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/fhir+json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-03-24T16:32:12.363Z\",\n \"source\": { \n \"type\": \"RelatedPerson\",\n \"identifier\": \"9000000001\" \n },\n \"item\": [\n {\n \"linkId\": \"proxy_details\",\n \"text\": \"Proxy details\",\n \"item\": [\n {\n \"linkId\": \"nhs_number\",\n \"text\": \"NHS Number\",\n \"answer\": [ \n {\n \"valueString\": \"9000000001\"\n }\n ]\n },\n {\n \"linkId\": \"relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"PRN\",\n \"display\": \"Parent\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient_details\",\n \"text\": \"Patient details\",\n \"item\": [\n {\n \"linkId\": \"nhs_number\",\n \"text\": \"NHS Number\",\n \"answer\": [\n {\n \"valueString\": \"9000000002\"\n }\n ]\n },\n {\n \"linkId\": \"first_name\",\n \"text\": \"First Name\",\n \"answer\": [\n {\n \"valueString\": \"Timmy\"\n }\n ]\n },\n {\n \"linkId\": \"last_name\",\n \"text\": \"Last name\",\n \"answer\": [\n {\n \"valueString\": \"Tenenbaum\"\n }\n ]\n },\n {\n \"linkId\": \"date_of_birth\",\n \"text\": \"Date of Birth\",\n \"answer\": [\n {\n \"valueDate\": \"2020-10-22\"\n }\n ]\n },\n {\n \"linkId\": \"postcode\",\n \"text\": \"Postcode\",\n \"answer\": [\n {\n \"valueString\": \"LS1 4AP\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requested_services\",\n \"text\": \"Requested services\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"appointments\",\n \"display\": \"manage appointments\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"medicines\",\n \"display\": \"manage medicines\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"records\",\n \"display\": \"access medical records\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"demographics\",\n \"display\": \"manage demographics and contact details\"\n }\n }\n ]\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "QuestionnaireResponse" - ] - }, - "description": "Example of a response where the given NHS numbers do not have a relationship." - }, - "response": [] + "item": [ + { + "name": "Questionnaire Response", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/fhir+json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-03-24T16:32:12.363Z\",\n \"source\": { \n \"type\": \"RelatedPerson\",\n \"identifier\": \"9000000001\" \n },\n \"item\": [\n {\n \"linkId\": \"proxy_details\",\n \"text\": \"Proxy details\",\n \"item\": [\n {\n \"linkId\": \"nhs_number\",\n \"text\": \"NHS Number\",\n \"answer\": [ \n {\n \"valueString\": \"9000000001\"\n }\n ]\n },\n {\n \"linkId\": \"relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"PRN\",\n \"display\": \"Parent\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient_details\",\n \"text\": \"Patient details\",\n \"item\": [\n {\n \"linkId\": \"nhs_number\",\n \"text\": \"NHS Number\",\n \"answer\": [\n {\n \"valueString\": \"9000000002\"\n }\n ]\n },\n {\n \"linkId\": \"first_name\",\n \"text\": \"First Name\",\n \"answer\": [\n {\n \"valueString\": \"Timmy\"\n }\n ]\n },\n {\n \"linkId\": \"last_name\",\n \"text\": \"Last name\",\n \"answer\": [\n {\n \"valueString\": \"Tenenbaum\"\n }\n ]\n },\n {\n \"linkId\": \"date_of_birth\",\n \"text\": \"Date of Birth\",\n \"answer\": [\n {\n \"valueDate\": \"2020-10-22\"\n }\n ]\n },\n {\n \"linkId\": \"postcode\",\n \"text\": \"Postcode\",\n \"answer\": [\n {\n \"valueString\": \"LS1 4AP\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requested_services\",\n \"text\": \"Requested services\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"appointments\",\n \"display\": \"manage appointments\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"medicines\",\n \"display\": \"manage medicines\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"records\",\n \"display\": \"access medical records\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentaction\",\n \"code\": \"demographics\",\n \"display\": \"manage demographics and contact details\"\n }\n }\n ]\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{api_base_url}}/QuestionnaireResponse", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ] + }, + "description": "Example of a response where the given NHS numbers do not have a relationship." + }, + "response": [] + } + ] } ], "event": [ @@ -268,4 +268,4 @@ "type": "string" } ] -} +} \ No newline at end of file From f3e219c617f22b7c516cdbce053484b46ee4808a Mon Sep 17 00:00:00 2001 From: Jack Plowman <62281988+JackPlowman@users.noreply.github.com> Date: Mon, 20 May 2024 10:58:01 +0100 Subject: [PATCH 7/7] NPA-2676 Extract FHIR/R4 into test variable --- sandbox/api/tests/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sandbox/api/tests/conftest.py b/sandbox/api/tests/conftest.py index 97b0dfe..79f2f00 100644 --- a/sandbox/api/tests/conftest.py +++ b/sandbox/api/tests/conftest.py @@ -2,8 +2,9 @@ from ..app import app -RELATED_PERSON_API_ENDPOINT = "/FHIR/R4/RelatedPerson" -QUESTIONNAIRE_RESPONSE_API_ENDPOINT = "/FHIR/R4/QuestionnaireResponse" +FHIR_PATH = "/FHIR/R4" +RELATED_PERSON_API_ENDPOINT = f"{FHIR_PATH}/RelatedPerson" +QUESTIONNAIRE_RESPONSE_API_ENDPOINT = f"{FHIR_PATH}/QuestionnaireResponse" @pytest.fixture()