Skip to content

Commit 912137f

Browse files
committed
NRL-1053 fix repository and perf tests
1 parent 0dced15 commit 912137f

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

layer/nrlf/core/dynamodb/repository.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -239,27 +239,28 @@ def search(
239239
patient_sort = f"C#{category_id}#T#{type_id}"
240240
key_conditions.append("begins_with(patient_sort, :patient_sort)")
241241
expression_values[":patient_sort"] = patient_sort
242+
else:
243+
# Handle single/multiple categories and pointer types with filter expressions
244+
if len(categories) == 1:
245+
split_category = categories[0].split("|")
246+
category_id = (
247+
SYSTEM_SHORT_IDS[split_category[0]] + "-" + split_category[1]
248+
)
249+
patient_sort = f"C#{category_id}"
250+
key_conditions.append("begins_with(patient_sort, :patient_sort)")
251+
expression_values[":patient_sort"] = patient_sort
252+
253+
if len(categories) > 1:
254+
expression_names["#category"] = "category"
255+
category_filters = [
256+
f"#category = :category_{i}" for i in range(len(categories))
257+
]
258+
caetgory_filter_values = {
259+
f":category_{i}": categories[i] for i in range(len(categories))
260+
}
261+
filter_expressions.append(f"({' OR '.join(category_filters)})")
262+
expression_values.update(caetgory_filter_values)
242263

243-
if len(categories) == 1:
244-
split_category = categories[0].split("|")
245-
category_id = SYSTEM_SHORT_IDS[split_category[0]] + "-" + split_category[1]
246-
patient_sort = f"C#{category_id}"
247-
key_conditions.append("begins_with(patient_sort, :patient_sort)")
248-
expression_values[":patient_sort"] = patient_sort
249-
250-
if len(categories) > 1:
251-
expression_names["#category"] = "category"
252-
category_filters = [
253-
f"#category = :category_{i}" for i in range(len(categories))
254-
]
255-
caetgory_filter_values = {
256-
f":category_{i}": categories[i] for i in range(len(categories))
257-
}
258-
filter_expressions.append(f"({' OR '.join(category_filters)})")
259-
expression_values.update(caetgory_filter_values)
260-
261-
# Handle multiple types if no category filter
262-
if not categories and len(pointer_types) > 1:
263264
expression_names["#pointer_type"] = "type"
264265
types_filters = [
265266
f"#pointer_type = :type_{i}" for i in range(len(pointer_types))

tests/performance/consumer/client.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
POINTER_IDS,
44
POINTER_TYPES,
55
ODS_CODE,
6+
CATEGORIES,
67
} from "../constants.js";
78
import http from "k6/http";
89
import { check } from "k6";

tests/performance/producer/client.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
POINTER_IDS,
77
POINTER_DOCUMENTS,
88
POINTERS_TO_DELETE,
9-
CATEGORIES,
109
} from "../constants.js";
1110
import { check } from "k6";
1211
import { randomItem } from "https://jslib.k6.io/k6-utils/1.2.0/index.js";

0 commit comments

Comments
 (0)