Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9c54796
[feature/PI-512-additional_interactions_drd] create additionl interac…
jaklinger Nov 1, 2024
1a348db
[feature/PI-512-additional_interactions_drd] update error message
jaklinger Nov 6, 2024
28a25c4
Initial test structure DRD search
jameslinnell Nov 5, 2024
11d5393
Create lambda code for searchDeviceReferenceData
jameslinnell Nov 5, 2024
2f6c0d9
Fix product_name
jameslinnell Nov 5, 2024
5a0e42f
search DRD tests
jameslinnell Nov 6, 2024
151d13b
searchDRD Swagger
jameslinnell Nov 6, 2024
6d3ec3d
searchDRD Feature Tests
jameslinnell Nov 7, 2024
0e0d952
feature/PI-578-create_mhs_device Create MHS Device enpoint, without d…
megan-bower4 Nov 7, 2024
1e39bc8
feature/PI-578-create_mhs_device PR enhancements
megan-bower4 Nov 8, 2024
129197a
feature/PI-578-create_mhs_device Move get_party_key to common steps
megan-bower4 Nov 8, 2024
b064b6b
Remove Location header from searchDRD
jameslinnell Nov 8, 2024
0a1f466
[release/2024-11-08] create release
jaklinger Nov 8, 2024
8b65ca8
Merge branch 'feature/PI-508-search_device_ref_data' into release/202…
jaklinger Nov 8, 2024
28a8ef7
Merge branch 'feature/PI-578-create_mhs_device' into release/2024-11-08
jaklinger Nov 8, 2024
d30144c
Merge branch 'feature/PI-512-additional_interactions_drd' into releas…
jaklinger Nov 8, 2024
ea00ae4
[release/2024-11-08] fix-forward: shorten lambda names and fix up test
jaklinger Nov 11, 2024
86cbabb
[release/2024-11-08] fix-forward: shorten lambda names and fix up test
jaklinger Nov 11, 2024
377f4d3
Fix DRD examples
jameslinnell Nov 11, 2024
92a1de9
Allow null values
jameslinnell Nov 11, 2024
4ceae34
Allow null values
jameslinnell Nov 12, 2024
68fbc75
release/2024-11-08 Update MhsDevice swagger
megan-bower4 Nov 12, 2024
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
3 changes: 1 addition & 2 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ permissions:

env:
BASE_CACHE_SUFFIX: base
#BASE_BRANCH_NAME: ${{ github.event.pull_request.base.ref }}
BASE_BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
BASE_BRANCH_NAME: ${{ github.event.pull_request.base.ref }}
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
CI_ROLE_NAME: ${{ secrets.CI_ROLE_NAME }}
BRANCH_GITHUB_SHA_SHORT: $(echo ${{ github.event.pull_request.head.sha }} | cut -c 1-7)
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2024-11-08
- [PI-508] Search DeviceReferenceData
- [PI-578] Create MHS Device
- [PI-512] AS Interactions DeviceReferenceData

## 2024-11-06
- [PI-593] Readme updates
- [PI-594] More smoke tests
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.11.06
2024.11.08
3 changes: 3 additions & 0 deletions changelog/2024-11-08.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [PI-508] Search DeviceReferenceData
- [PI-578] Create MHS Device
- [PI-512] AS Interactions DeviceReferenceData
72 changes: 72 additions & 0 deletions infrastructure/swagger/05_paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,26 @@ paths:
- app-level0: []

/ProductTeam/{product_team_id}/Product/{product_id}/DeviceReferenceData:
get:
operationId: searchDeviceReferenceData
summary: Retrieve all Data Reference Data resources associated with a Product (GET)
parameters:
- $ref: "#/components/parameters/ProductTeamId"
- $ref: "#/components/parameters/ProductId"
- $ref: "#/components/parameters/HeaderVersion"
- $ref: "#/components/parameters/HeaderRequestId"
- $ref: "#/components/parameters/HeaderCorrelationId"
responses:
"200":
$ref: "#/components/responses/DeviceRefDataSearch"
"404":
$ref: "#/components/responses/NotFound"
x-amazon-apigateway-integration:
<<: *ApiGatewayIntegration
uri: ${method_searchDeviceReferenceData}
security:
- ${authoriser_name}: []
- app-level0: []
post:
operationId: createDeviceReferenceData
summary: Create a Device Reference Data resource (POST)
Expand Down Expand Up @@ -241,6 +261,32 @@ paths:
- ${authoriser_name}: []
- app-level0: []

? /ProductTeam/{product_team_id}/Product/{product_id}/DeviceReferenceData/AccreditedSystemsAdditionalInteractions
: post:
operationId: createDeviceReferenceDataAdditionalInteractions
summary: Create a Device Reference Data Additional Interactions resource (POST)
parameters:
- $ref: "#/components/parameters/ProductTeamId"
- $ref: "#/components/parameters/ProductId"
- $ref: "#/components/parameters/HeaderVersion"
- $ref: "#/components/parameters/HeaderRequestId"
- $ref: "#/components/parameters/HeaderCorrelationId"
requestBody:
$ref: "#/components/requestBodies/DeviceReferenceDataAdditionalInteractionsCreateRequestBody"
responses:
"201":
$ref: "#/components/responses/DeviceRefDataCreate"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
x-amazon-apigateway-integration:
<<: *ApiGatewayIntegration
uri: ${method_createDeviceReferenceDataASActions}
security:
- ${authoriser_name}: []
- app-level0: []

? /ProductTeam/{product_team_id}/Product/{product_id}/DeviceReferenceData/{device_reference_data_id}
: get:
operationId: readDeviceReferenceData
Expand Down Expand Up @@ -313,6 +359,32 @@ paths:
- ${authoriser_name}: []
- app-level0: []

? /ProductTeam/{product_team_id}/Product/{product_id}/Device/MessageHandlingSystem
: post:
operationId: createDeviceMessageHandlingSystem
summary: Create a Message Handling System Device resource (POST)
parameters:
- $ref: "#/components/parameters/ProductTeamId"
- $ref: "#/components/parameters/ProductId"
- $ref: "#/components/parameters/HeaderVersion"
- $ref: "#/components/parameters/HeaderRequestId"
- $ref: "#/components/parameters/HeaderCorrelationId"
requestBody:
$ref: "#/components/requestBodies/MessageHandlingSystemDeviceCreateRequestBody"
responses:
"201":
$ref: "#/components/responses/MhsDeviceCreate"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
x-amazon-apigateway-integration:
<<: *ApiGatewayIntegration
uri: ${method_createDeviceMessageHandlingSystem}
security:
- ${authoriser_name}: []
- app-level0: []

/searchSdsDevice:
get:
operationId: searchsdsdevice
Expand Down
82 changes: 79 additions & 3 deletions infrastructure/swagger/07_components--schemas--domain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ components:
message:
type: string
StatusOK:
type: object
type: string
properties:
code:
type: string
Expand All @@ -38,8 +38,10 @@ components:
type: string
updated_on:
type: string
nullable: true
deleted_on:
type: string
nullable: true
keys:
type: array
items:
Expand Down Expand Up @@ -86,8 +88,10 @@ components:
type: string
updated_on:
type: string
nullable: true
deleted_on:
type: string
nullable: true
example:
id: "123-XXX"
name: "Sample Product Team"
Expand Down Expand Up @@ -115,7 +119,7 @@ components:
items:
$ref: "#/components/schemas/ProductResponse"
example:
result:
results:
- id: "123-XXX"
name: "Sample Product Team"
product_team_id: "F5H1R.55e86121-3826-468c-a6f0-dd0f1fbc0259"
Expand Down Expand Up @@ -147,8 +151,45 @@ components:
type: string
updated_on:
type: string
nullable: true
deleted_on:
type: string
nullable: true
keys:
type: array
items:
type: object
properties:
key_type:
type: string
key_value:
type: string
questionnaire_responses:
type: object

MhsDeviceResponse:
type: object
properties:
id:
type: string
name:
type: string
product_id:
type: string
product_team_id:
type: string
ods_code:
type: string
status:
type: string
created_on:
type: string
updated_on:
type: string
nullable: true
deleted_on:
type: string
nullable: true
keys:
type: array
items:
Expand All @@ -160,12 +201,12 @@ components:
type: string
questionnaire_responses:
type: object
properties:

DeviceSearchResponse:
type: array
items:
$ref: "#/components/schemas/DeviceResponse"

DeviceReferenceDataResponse:
type: object
properties:
Expand All @@ -185,7 +226,42 @@ components:
type: string
updated_on:
type: string
nullable: true
deleted_on:
type: string
nullable: true
questionnaire_responses:
type: object
example:
id: "55e86121-3826-468c-a6f0-dd0f1fbc0259"
name: "Sample DeviceReferenceDataResponse"
product_id: "123-XXX"
product_team_id: "F5H1R.55e86121-3826-468c-a6f0-dd0f1fbc0259"
ods_code: "F5H1R"
questionnaire_responses:
- key_type: "foo"
key_value: "bar"
created_on: "2025-10-15T10:00:00Z"
updated_on: "null"
deleted_on: "null"

DeviceRefDataSearchResponse:
type: object
properties:
result:
type: array
items:
$ref: "#/components/schemas/DeviceReferenceDataResponse"
example:
results:
- id: "55e86121-3826-468c-a6f0-dd0f1fbc0259"
name: "Sample Device Reference Data"
product_id: "123-XXX"
product_team_id: "F5H1R.55e86121-3826-468c-a6f0-dd0f1fbc0259"
ods_code: "F5H1R"
questionnaire_responses:
- key_type: "foo"
key_value: "bar"
created_on: "2024-10-15T10:00:00Z"
updated_on: "null"
deleted_on: "null"
42 changes: 42 additions & 0 deletions infrastructure/swagger/11_components--requestBodies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,26 @@ components:
description: Questionnaire Responses
required:
- questionnaire_responses
DeviceReferenceDataAdditionalInteractionsCreateRequestBody:
description: Request body to create a Device Reference Data Additional Interactions object
required: true
content:
application/json:
schema:
type: object
properties:
questionnaire_responses:
type: object
description: Questionnaire Responses for Additional Interactions questionnaire
properties:
spine_as_additional_interactions:
type: array
description: List of questionnaires associated with the additional interactions
items:
type: object
description: Questionnaire Responses
required:
- questionnaire_responses
DeviceCreateRequestBody:
description: Request body to create a Device object
required: true
Expand All @@ -102,3 +122,25 @@ components:
- name
example:
name: "Sample Device"
MessageHandlingSystemDeviceCreateRequestBody:
description: Request body to create a Message Handling System Device object
required: true
content:
application/json:
schema:
type: object
properties:
questionnaire_responses:
type: object
description: Questionnaire Responses for MHS Device
properties:
spine_mhs:
type: array
description: spine_mhs questionnaire associated with the mhs device
items:
type: object
description: spine_mhs questionnaire response
required:
- questionnaire_responses
example:
questionnaire_responses: { "spine_mhs": [{ "question": "answer" }] }
20 changes: 20 additions & 0 deletions infrastructure/swagger/12_components--responses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,19 @@ components:
errors:
- code: "MISSING_VALUE"
message: "<MISSING_FIELD>: field required"
- code: "MISSING_VALUE"
message: "Failed to validate data against '<QUESTIONNAIRE>': '<MISSING_FIELD>' is a required property"
ValidationError:
value:
errors:
- code: "VALIDATION_ERROR"
message: "Item already exists"
- code: "VALIDATION_ERROR"
message: "Expected only one response for the '<QUESTIONNAIRE _NAME>' questionnaire"
- code: "VALIDATION_ERROR"
message: "Require a 'spine_mhs' questionnaire response to create a MHS Device"
- code: "VALIDATION_ERROR"
message: "Not an EPR Product: Cannot create MHS device for product without exactly one Party Key"
SdsSearchDeviceBadRequest:
description: searchSDSDevice Bad request
content:
Expand Down Expand Up @@ -139,6 +147,12 @@ components:
application/json:
schema:
$ref: "#/components/schemas/DeviceReferenceDataResponse"
DeviceRefDataSearch:
description: Search Device Reference Data operation successful
content:
application/json:
schema:
$ref: "#/components/schemas/DeviceRefDataSearchResponse"
DeviceCreate:
description: Create Device operation successful
content:
Expand All @@ -151,6 +165,12 @@ components:
application/json:
schema:
$ref: "#/components/schemas/DeviceResponse"
MhsDeviceCreate:
description: Create Message Handling System Device operation successful
content:
application/json:
schema:
$ref: "#/components/schemas/MhsDeviceResponse"
SdsDeviceSearch:
description: Search Device operation successful
content:
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/terraform/per_workspace/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module "lambdas" {
source = "./modules/api_worker/api_lambda"
python_version = var.python_version
name = each.key
lambda_name = "${local.project}--${replace(terraform.workspace, "_", "-")}--${replace(replace(each.key, "_", "-"), "DeviceReferenceData", "DeviceRefData")}"
lambda_name = "${local.project}--${replace(terraform.workspace, "_", "-")}--${replace(replace(replace(each.key, "_", "-"), "DeviceReferenceData", "DeviceRefData"), "MessageHandlingSystem", "MHS")}"
//Compact will remove all nulls from the list and create a new one - this is because TF throws an error if there is a null item in the list.
layers = concat(
compact([for instance in module.layers : contains(var.api_lambda_layers, instance.name) ? instance.layer_arn : null]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ locals {
}
methods = [
for lambda_alias in setsubtract(var.lambdas, ["authoriser"]) :
{ "method_${lambda_alias}" = "${local.apigateway_lambda_arn_prefix}:${var.assume_account}:function:${var.project}--${replace(terraform.workspace, "_", "-")}--${replace(replace(lambda_alias, "_", "-"), "DeviceReferenceData", "DeviceRefData")}/invocations" }
{ "method_${lambda_alias}" = "${local.apigateway_lambda_arn_prefix}:${var.assume_account}:function:${var.project}--${replace(terraform.workspace, "_", "-")}--${replace(replace(replace(lambda_alias, "_", "-"), "DeviceReferenceData", "DeviceRefData"), "MessageHandlingSystem", "MHS")}/invocations" }
]
swagger_file = templatefile("${path.root}/../../swagger/dist/aws/swagger.yaml", merge({
lambda_invoke_arn = var.authoriser_metadata.lambda_invoke_arn,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "connecting-party-manager"
version = "2024.11.06"
version = "2024.11.08"
description = "Repository for the Connecting Party Manager API and related services"
authors = ["NHS England"]
license = "LICENSE.md"
Expand Down
4 changes: 1 addition & 3 deletions scripts/infrastructure/swagger/merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ function _02_clean(){
yq 'del(.x-ibm-configuration)' |
yq 'del(.components.schemas.*.discriminator)' |
yq 'explode(.)' |
yq '(.. | select(style == "single")) style |= "double"' |
# Remove null dead-ends
yq 'del(.. | select(. == null))' \
yq '(.. | select(style == "single")) style |= "double"' \
> ${_02_CLEAN_FILE}
validate_yaml ${_02_CLEAN_FILE}
}
Expand Down
Loading