Skip to content

Feature/CDAPI 111#87

Open
nhsd-rebecca-flynn wants to merge 18 commits intomainfrom
feature/CDAPI-111
Open

Feature/CDAPI 111#87
nhsd-rebecca-flynn wants to merge 18 commits intomainfrom
feature/CDAPI-111

Conversation

@nhsd-rebecca-flynn
Copy link
Copy Markdown
Contributor

Description

Adds MNS Mock Implementation with relevant unit tests

Context

Similar changes to the PDM Mock Implementation.

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming
  • Exceptions/Exclusions to coding standards (e.g. #noqa or #NOSONAR) are included within this Pull Request.

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@nhsd-rebecca-flynn nhsd-rebecca-flynn force-pushed the feature/CDAPI-111 branch 2 times, most recently from b70406c to dbe777c Compare April 9, 2026 17:49
@nhsd-rebecca-flynn nhsd-rebecca-flynn marked this pull request as ready for review April 10, 2026 12:58
@nhsd-rebecca-flynn nhsd-rebecca-flynn requested review from a team as code owners April 10, 2026 12:58
Copy link
Copy Markdown
Collaborator

@nhsd-jack-wainwright nhsd-jack-wainwright left a comment

Choose a reason for hiding this comment

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

LGTM 👍 , just a couple minor suggestions around the get event endpoint.

def _get_event_from_table(subject: str) -> EventItem:
expression = Attr("subject").eq(subject)
item = storage_helper.find_items(expression)[0]
return cast("EventItem", item)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rather than just casting here, I wonder if its worth checking the type and throwing an error if the type is incorrect

Suggested change
return cast("EventItem", item)
if not isinstance(item, EventItem):
raise ValueError(f"Event found but was not correct type. {item}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can't include this instance off check here due to EventItem being a TypedDict, meaning its type cannot be checked at runtime.



@mns_routes.get("/mns/mock/event/<subject>")
def get_event(subject: str) -> Response[str]:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rather than being a get endpoint, I wonder if this endpoint would make more sense as a search endpoint that accepted a query param. That way multiple events could be returned as its possible that multiple events have been created for the same subject.

Perhaps the endpoint could look something like /mns/mock/event?subject=<subject>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Updated to instead be a find_events endpoint as suggested.

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Deployment Complete

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