Skip to content

Conversation

@edhall-nhs
Copy link
Contributor

Summary

  • Routine Change
  • ⚠️ Potential issues that might be caused by this change

Consolidate audit table related functions for the batch flow into the shared code directory.

⚠️ This also changed and consolidated the log messages for all updated items. So e2e tests that verify log messages will need to be updated when in testing if there are any.

Reviews Required

  • Dev
  • Test
  • Tech Author
  • Product Owner

Review Checklist

ℹ️ This section is to be filled in by the reviewer.

  • I have reviewed the changes in this PR and they fill all of the acceptance criteria of the ticket.
  • If there were infrastructure, operational, or build changes, I have made sure there is sufficient evidence that the changes will work.
  • If there were changes that are outside of the regular release processes e.g. account infrastructure to setup, manual setup for external API integrations, secrets to set, then I have checked that the developer has flagged this to the Tech Lead as release steps.
  • I have checked that no Personal Identifiable Data (PID) is logged as part of the changes.

ConditionExpression="attribute_exists(message_id)",
@staticmethod
def update_status(file_key: str, message_id: str, updated_status: str) -> None:
update_audit_table_item(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I imported the shared function here as the rest of this lambda is class/oop based so didn't think it was worth refactoring. Can do if needed.

raise UnhandledAuditTableError(error) from error


def _build_update_expression_attribute_names_and_values(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure about the name of this function. Happy to take suggestions or if it makes sense to others, leave as is.

Also not overly fond of reassigning and mutating the variables but hopefully I've made it clear that this func should be private and only used here. In which case I guess it's okay? Again, happy to take suggestions

Copy link
Contributor

@JamesW1-NHS JamesW1-NHS Jan 15, 2026

Choose a reason for hiding this comment

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

It's an ugly name but a fully descriptive one :)

Maybe there's no need to pass the empty dicts in at all - just create them as locals and return a tuple.

@sonarqubecloud
Copy link

@edhall-nhs edhall-nhs deployed to internal-dev-sandbox January 15, 2026 17:17 — with GitHub Actions Active
@edhall-nhs edhall-nhs deployed to internal-dev January 15, 2026 17:19 — with GitHub Actions Active
@edhall-nhs edhall-nhs marked this pull request as ready for review January 15, 2026 17:21
"file_level_validation.set_audit_table_ingestion_start_time"
)

self.update_audit_table_item_pather = patch("file_level_validation.update_audit_table_item")
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo - should be 'patcher'

def update_audit_table_item(
file_key: str,
message_id: str,
optional_params: dict[AuditTableKeys, any],
Copy link
Contributor

Choose a reason for hiding this comment

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

As Dan said, they're not really optional parameters. If we pass { }, then we end up calling update_item() with an unchanged item. If we pass None, then optional_parameters.items() will raise an AttributeError.

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.

2 participants