Skip to content

Commit 68dcb45

Browse files
committed
NRL-1053 PR comments
1 parent f606179 commit 68dcb45

File tree

9 files changed

+10
-20
lines changed

9 files changed

+10
-20
lines changed

api/consumer/searchDocumentReference/search_document_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def handler(
6161
if not validate_category(params.category):
6262
logger.log(
6363
LogReference.CONSEARCH002b,
64-
type=params.category,
64+
category=params.category,
6565
) # TODO - Should update error message once permissioning by category is implemented
6666
return SpineErrorResponse.INVALID_CODE_SYSTEM(
6767
diagnostics="Invalid query parameter (The provided category is not valid)",

api/consumer/swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ components:
15591559
summary: Diagnostic studies report
15601560
value: http://snomed.info/sct|721981007
15611561
SNOMED_CODES_DIAGNOSTIC_PROCEDURE:
1562-
summary: RDiagnostic procedure
1562+
summary: Diagnostic procedure
15631563
value: http://snomed.info/sct|103693007
15641564
invalid:
15651565
summary: Unknown

api/producer/searchDocumentReference/tests/test_search_document_reference_producer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def test_search_document_reference_filters_by_type(
319319

320320
@mock_aws
321321
@mock_repository
322-
def test_search_document_reference_filters_by_type(
322+
def test_search_document_reference_filters_by_category(
323323
repository: DocumentPointerRepository,
324324
):
325325
doc_ref = load_document_reference("Y05868-736253002-Valid")

api/producer/swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ components:
20662066
summary: Diagnostic studies report
20672067
value: http://snomed.info/sct|721981007
20682068
SNOMED_CODES_DIAGNOSTIC_PROCEDURE:
2069-
summary: RDiagnostic procedure
2069+
summary: Diagnostic procedure
20702070
value: http://snomed.info/sct|103693007
20712071
invalid:
20722072
summary: Unknown

layer/nrlf/core/dynamodb/repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ def search(
255255
category_filters = [
256256
f"#category = :category_{i}" for i in range(len(categories))
257257
]
258-
caetgory_filter_values = {
258+
category_filter_values = {
259259
f":category_{i}": categories[i] for i in range(len(categories))
260260
}
261261
filter_expressions.append(f"({' OR '.join(category_filters)})")
262-
expression_values.update(caetgory_filter_values)
262+
expression_values.update(category_filter_values)
263263

264264
expression_names["#pointer_type"] = "type"
265265
types_filters = [

layer/nrlf/core/validators.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,7 @@ def validate_category(category_: Optional[RequestQueryCategory]) -> bool:
4343
if not category_:
4444
return True
4545

46-
category_system = category_.root.split("|", 1)[0]
47-
category_code = category_.root.split("|", 1)[1]
48-
49-
category_list = Categories.list()
50-
category_systems = [category.split("|", 1)[0] for category in category_list]
51-
category_codes = [category.split("|", 1)[1] for category in category_list]
52-
53-
if not category_system in category_systems:
54-
return False
55-
56-
return category_code in category_codes
46+
return category_.root in Categories.list()
5747

5848

5949
@dataclass

swagger/consumer-static/components.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ components:
3737
schema:
3838
$ref: "#/components/schemas/RequestQueryType"
3939
category:
40-
name: type
40+
name: category
4141
in: query
4242
schema:
4343
$ref: "#/components/schemas/RequestQueryCategory"

tests/features/consumer/searchDocumentReference-failure.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Feature: Consumer - searchDocumentReference - Failure Scenarios
192192
}
193193
"""
194194

195-
Scenario: Search rejects request with type system they are not allowed to use
195+
Scenario: Search rejects request with invalid category system
196196
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
197197
And the organisation 'RX898' is authorised to access pointer types:
198198
| system | value |

tests/features/consumer/searchPostDocumentReference-failure.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Feature: Consumer - searchDocumentReference - Failure Scenarios
192192
}
193193
"""
194194

195-
Scenario: Search for multiple DocumentReferences by NHS number and an invalid Category
195+
Scenario: Search rejects request with category system they are not allowed to use
196196
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
197197
And the organisation 'RX898' is authorised to access pointer types:
198198
| system | value |

0 commit comments

Comments
 (0)