Skip to content

Conversation

@steph-torres-nhs
Copy link
Contributor

@steph-torres-nhs steph-torres-nhs commented Dec 17, 2025

Overview

Jira ticket: PRMP-1079

Description

Find another method of returning the expected number of results using a limit and pagination when querying dynamodb

Context

Using a limit along side a filter expression within a dynamodb query doesn't return the number of results as initially expected, the filter is applied after the limit.

Checklist

Tasks for all changes:

@steph-torres-nhs steph-torres-nhs marked this pull request as ready for review December 18, 2025 10:18
@steph-torres-nhs steph-torres-nhs requested review from a team as code owners December 18, 2025 10:18
Comment on lines 93 to 106
response = self.dynamo_service.query_table_with_paginator(
table_name=self.table_name,
index_name="CustodianIndex",
key="Custodian",
condition=ods_code,
filter_expression=filter_expression,
expression_attribute_names=condition_attribute_names,
expression_attribute_values=condition_attribute_values,
start_key=start_key,
limit=limit,
)

references = self._validate_review_references(response["Items"])
last_evaluated_key = response.get("NextToken")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be in DocumentService

filter_expression, condition_attribute_names, condition_attribute_values = (
self.build_paginator_query_filter(nhs_number=nhs_number, uploader=uploader)
)
response = self.dynamo_service.query_table_with_paginator(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DocumentService?

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants