Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21,584 changes: 10,792 additions & 10,792 deletions postman/validated_relationship_service.integration.postman_collection.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions sandbox/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PATIENT_IDENTIFIERS = ["9000000017", "9000000033", "9000000042"]
RELATED_IDENTIFIERS = ["9000000009", "9000000025", "9000000042"]

CONSENT_GRANTEE = "Consent:grantee"
CONSENT_PERFORMER = "Consent:performer"
CONSENT_PATIENT = "Consent:patient"

# Example files
Expand All @@ -29,47 +29,47 @@
)
GET_CONSENT__MULTIPLE_RELATIONSHIPS = f"{GET_CONSENT__DIRECTORY}multiple-relationships.yaml"
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_BOTH = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-include-grantee-patient.yaml"
f"{GET_CONSENT__DIRECTORY}multiple-relationships-include-performer-patient.yaml"
)
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_PATIENT = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-include-patient.yaml"
)
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_GRANTEE = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-include-grantee.yaml"
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_PERFORMER = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-include-performer.yaml"
)
GET_CONSENT__NO_RELATIONSHIPS = f"{GET_CONSENT__DIRECTORY}no-relationships.yaml"
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP = f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship.yaml"
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_BOTH = (
f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-grantee-patient.yaml"
f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-performer-patient.yaml"
)
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PATIENT = (
f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-patient.yaml"
)
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_GRANTEE = (
f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-grantee.yaml"
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PERFORMER = (
f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-performer.yaml"
)
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP = f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship.yaml"
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH = (
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-grantee-patient.yaml"
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-performer-patient.yaml"
)
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT = (
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-patient.yaml"
)
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_GRANTEE = (
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-grantee.yaml"
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER = (
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-performer.yaml"
)
GET_CONSENT__STATUS_PARAM_INVALID = f"{GET_CONSENT__DIRECTORY}errors/invalid-status-parameter.yaml"
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient.yaml"
)
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_GRANTEE = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient-include-grantee.yaml"
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_PERFORMER = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient-include-performer.yaml"
)
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_PATIENT = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient-include-patient.yaml"
)
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_BOTH = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient-include-grantee-patient.yaml"
f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient-include-performer-patient.yaml"
)
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS = (
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-unknown-legal-basis.yaml"
Expand Down
8 changes: 4 additions & 4 deletions sandbox/api/get_consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
GET_CONSENT__FILTERED_RELATIONSHIPS_STATUS_PROPOSED_ACTIVE,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_PATIENT,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_GRANTEE,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_PERFORMER,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_BOTH,
GET_CONSENT__MULTIPLE_RELATIONSHIPS,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_BOTH,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_PATIENT,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_GRANTEE,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_PERFORMER,
GET_CONSENT__NO_RELATIONSHIPS,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_BOTH,
Expand Down Expand Up @@ -79,7 +79,7 @@ def get_consent_response() -> Union[dict, tuple]:
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_BOTH,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_PATIENT,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_GRANTEE,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_PERFORMER,
)
# Filtering
elif performer_identifier == "9000000017":
Expand All @@ -97,7 +97,7 @@ def get_consent_response() -> Union[dict, tuple]:
GET_CONSENT__MULTIPLE_RELATIONSHIPS,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_BOTH,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_PATIENT,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_GRANTEE,
GET_CONSENT__MULTIPLE_RELATIONSHIPS_INCLUDE_PERFORMER,
)
# No relationships
elif performer_identifier == "9000000025":
Expand Down
8 changes: 4 additions & 4 deletions sandbox/api/get_consent_by_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_BOTH,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PATIENT,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_GRANTEE,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PERFORMER,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_GRANTEE,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER,
GET_CONSENT_BY_ID__INVALID_ID_ERROR,
BAD_REQUEST_INCLUDE_PARAM_INVALID,
INVALIDATED_RESOURCE,
Expand Down Expand Up @@ -41,15 +41,15 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]:
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_BOTH,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PATIENT,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_GRANTEE,
GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PERFORMER,
)
elif identifier == "39df03a2-1b14-4d19-b1dc-d5d8cbf96948":
return check_for_consent_include_params(
_include,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_GRANTEE,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER,
)
elif identifier == "a0922245-1072-40c3-8f4e-a7490c10d365":
return generate_response_from_example(INVALIDATED_RESOURCE, 404)
Expand Down
3 changes: 1 addition & 2 deletions sandbox/api/post_consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def post_consent_response() -> Union[dict, tuple]:
logger.debug("Received request to POST consent")
# Validate body - beyond the scope of sandbox - assume body is valid for scenario
json = request.get_json()
grantee_ext = next(ext for ext in json["extension"] if "grantee" in ext["url"])
patient_identifier = grantee_ext["valueReference"]["identifier"]["value"]
patient_identifier = json["performer"][0]["identifier"]["value"]
response = None

# Successful parent-child proxy creation
Expand Down
44 changes: 22 additions & 22 deletions sandbox/api/tests/test_get_consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_get_consent_returns_expected_responses__mocked_get_consent(
("request_args", "response_file_name", "status_code"),
[
(
"performer:identifier=9000000017&status=active&_include=Consent:grantee&_include=Consent:patient",
"performer:identifier=9000000017&status=active&_include=Consent:performer&_include=Consent:patient",
"./api/examples/GET_Consent/filtered-relationships-status-active-include-details.yaml",
200,
),
Expand Down Expand Up @@ -86,13 +86,13 @@ def test_get_consent_returns_expected_responses__mocked_get_consent(
200,
),
(
"performer:identifier=9000000022&_include=Consent:grantee",
"./api/examples/GET_Consent/multiple-relationships-include-grantee.yaml",
"performer:identifier=9000000022&_include=Consent:performer",
"./api/examples/GET_Consent/multiple-relationships-include-performer.yaml",
200,
),
(
"performer:identifier=9000000022&_include=Consent:grantee&_include=Consent:patient",
"./api/examples/GET_Consent/multiple-relationships-include-grantee-patient.yaml",
"performer:identifier=9000000022&_include=Consent:performer&_include=Consent:patient",
"./api/examples/GET_Consent/multiple-relationships-include-performer-patient.yaml",
200,
),
(
Expand All @@ -111,18 +111,18 @@ def test_get_consent_returns_expected_responses__mocked_get_consent(
200,
),
(
"performer:identifier=9000000010&_include=Consent:grantee&_include=Consent:patient",
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-grantee-patient.yaml",
"performer:identifier=9000000010&_include=Consent:performer&_include=Consent:patient",
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml",
200,
),
(
"patient:identifier=9000000005&_include=Consent:grantee&_include=Consent:patient",
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-grantee-patient.yaml",
"patient:identifier=9000000005&_include=Consent:performer&_include=Consent:patient",
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml",
200,
),
(
"performer:identifier=9000000010&patient:identifier=9000000005&_include=Consent:grantee&_include=Consent:patient", # noqa: E501
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-grantee-patient.yaml",
"performer:identifier=9000000010&patient:identifier=9000000005&_include=Consent:performer&_include=Consent:patient", # noqa: E501
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml",
200,
),
(
Expand All @@ -141,18 +141,18 @@ def test_get_consent_returns_expected_responses__mocked_get_consent(
200,
),
(
"performer:identifier=9000000019&_include=Consent:grantee&_include=Consent:patient",
"./api/examples/GET_Consent/single-mother-child-relationship-include-grantee-patient.yaml",
"performer:identifier=9000000019&_include=Consent:performer&_include=Consent:patient",
"./api/examples/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml",
200,
),
(
"patient:identifier=9000000009&_include=Consent:grantee&_include=Consent:patient",
"./api/examples/GET_Consent/single-mother-child-relationship-include-grantee-patient.yaml",
"patient:identifier=9000000009&_include=Consent:performer&_include=Consent:patient",
"./api/examples/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml",
200,
),
(
"performer:identifier=9000000019&patient:identifier=9000000009&_include=Consent:grantee&_include=Consent:patient", # noqa: E501
"./api/examples/GET_Consent/single-mother-child-relationship-include-grantee-patient.yaml",
"performer:identifier=9000000019&patient:identifier=9000000009&_include=Consent:performer&_include=Consent:patient", # noqa: E501
"./api/examples/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml",
200,
),
(
Expand All @@ -161,8 +161,8 @@ def test_get_consent_returns_expected_responses__mocked_get_consent(
200,
),
(
"patient:identifier=9000000100&_include=Consent:grantee",
"./api/examples/GET_Consent/multiple-relationships-single-patient-include-grantee.yaml",
"patient:identifier=9000000100&_include=Consent:performer",
"./api/examples/GET_Consent/multiple-relationships-single-patient-include-performer.yaml",
200,
),
(
Expand All @@ -171,8 +171,8 @@ def test_get_consent_returns_expected_responses__mocked_get_consent(
200,
),
(
"patient:identifier=9000000100&_include=Consent:grantee&_include=Consent:patient",
"./api/examples/GET_Consent/multiple-relationships-single-patient-include-grantee-patient.yaml",
"patient:identifier=9000000100&_include=Consent:performer&_include=Consent:patient",
"./api/examples/GET_Consent/multiple-relationships-single-patient-include-performer-patient.yaml",
200,
),
(
Expand Down Expand Up @@ -239,6 +239,6 @@ def test_get_consent__500_internal_server_error(
"""Test Consent endpoint."""
mock_remove_system.side_effect = Exception("Test exception")
# Act
client.get(f"{CONSENT_API_ENDPOINT}?performer:identifier=9000000015&status=active&_include=Consent:grantee")
client.get(f"{CONSENT_API_ENDPOINT}?performer:identifier=9000000015&status=active&_include=Consent:performer")
# Assert
mock_generate_response_from_example.assert_called_once_with("./api/examples/errors/internal-server-error.yaml", 500)
16 changes: 8 additions & 8 deletions sandbox/api/tests/test_get_consent_by_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def test_get_consent_by_id_returns_expected_responses__mocked_get_consent_by_id(
),
(
"74eed847-ca25-4e76-8cf2-f2c2d7842a7a", # Single consenting adult relationship with include performer
"_include=Consent:grantee",
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-grantee.yaml",
"_include=Consent:performer",
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-performer.yaml",
200,
),
(
Expand All @@ -84,8 +84,8 @@ def test_get_consent_by_id_returns_expected_responses__mocked_get_consent_by_id(
),
(
"74eed847-ca25-4e76-8cf2-f2c2d7842a7a", # Single consenting adult relationship with include both
"_include=Consent:grantee&_include=Consent:patient",
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-grantee-patient.yaml",
"_include=Consent:performer&_include=Consent:patient",
"./api/examples/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml",
200,
),
(
Expand All @@ -96,8 +96,8 @@ def test_get_consent_by_id_returns_expected_responses__mocked_get_consent_by_id(
),
(
"39df03a2-1b14-4d19-b1dc-d5d8cbf96948", # Single adult-child relationship with include performer
"_include=Consent:grantee",
"./api/examples/GET_Consent/single-mother-child-relationship-include-grantee.yaml",
"_include=Consent:performer",
"./api/examples/GET_Consent/single-mother-child-relationship-include-performer.yaml",
200,
),
(
Expand All @@ -108,8 +108,8 @@ def test_get_consent_by_id_returns_expected_responses__mocked_get_consent_by_id(
),
(
"39df03a2-1b14-4d19-b1dc-d5d8cbf96948", # Single adult-child relationship with include both
"_include=Consent:grantee&_include=Consent:patient",
"./api/examples/GET_Consent/single-mother-child-relationship-include-grantee-patient.yaml",
"_include=Consent:performer&_include=Consent:patient",
"./api/examples/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml",
200,
),
],
Expand Down
9 changes: 1 addition & 8 deletions sandbox/api/tests/test_post_consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,8 @@ def test_post_consent_when_valid_returns_expected_response(
status=status_code,
content_type="application/json",
)
json = {"performer": [{"identifier": {"value": nhs_num}}]}
# Act
json = {
"extension": [
{
"url": "https://hl7.org/fhir/5.0/StructureDefinition/extension-Consent.grantee",
"valueReference": {"identifier": {"value": nhs_num}},
}
]
}
response = client.post(CONSENT_API_ENDPOINT, json=json)
# Assert
if id is not None:
Expand Down
Loading
Loading