Skip to content

VED-1260 Mock PDS lambda rate limiting in ref env#1427

Open
amarauzoma wants to merge 31 commits intomasterfrom
VED-1235-Lambda-to-mock-PDS-in-Ref
Open

VED-1260 Mock PDS lambda rate limiting in ref env#1427
amarauzoma wants to merge 31 commits intomasterfrom
VED-1235-Lambda-to-mock-PDS-in-Ref

Conversation

@amarauzoma
Copy link
Copy Markdown
Contributor

@amarauzoma amarauzoma commented Apr 17, 2026

  • Added a new Lambda function to simulate PDS responses for patient lookups.
  • Implemented rate limiting with configurable average and spike thresholds.
  • Updated existing MNS publisher to utilize the new PDS base URL environment variable.
  • Enhanced tests to cover scenarios with the mock PDS service, including rate limit handling.
  • Created performance testing scripts to validate MNS behavior under load with the mock PDS.
  • Updated infrastructure to route PDS calls in the ref environment to the mock endpoint.

amarauzoma and others added 2 commits April 17, 2026 12:51
- Added a new Lambda function to simulate PDS responses for patient lookups.
- Implemented rate limiting with configurable average and spike thresholds.
- Updated existing MNS publisher to utilize the new PDS base URL environment variable.
- Enhanced tests to cover scenarios with the mock PDS service, including rate limit handling.
- Created performance testing scripts to validate MNS behavior under load with the mock PDS.
- Updated infrastructure to route PDS calls in the ref environment to the mock endpoint.
- Streamlined the initialization of MockPdsService by consolidating parameters.
- Replaced multiple response methods with a unified error handling approach.
- Enhanced readability by reducing redundant code in the patient lookup logic.
- Updated tests to utilize helper functions for event creation and decision mocking.
@amarauzoma amarauzoma changed the title feat: Introduce Mock PDS Lambda for MNS integration testing VED-1235 Lambda-to-mock-PDS-in-Ref Apr 17, 2026
- Deleted the performance testing plan document for MNS integration with mocked PDS.
- This document outlined objectives, delivery approaches, and existing architecture for implementing a mocked PDS service.
…mock-PDS-in-Ref

Made-with: Cursor

# Conflicts:
#	tests/perf_tests/Makefile
- Removed the global service retrieval function and directly initialized the MockPdsService with a Redis client and rate limiter.
- Updated the lambda_handler to use the initialized service directly, improving performance and readability.
- Adjusted unit tests to accommodate the new service initialization approach, ensuring proper mocking and error handling.
… tests

- Updated sonar-project.properties to include coverage report for mock_pds.
- Added new unit tests for Mock PDS service to improve test coverage and handle edge cases.
- Introduced a new test file for rate limiting functionality in the Mock PDS service.
- Updated the quality-checks workflow to run tests for the new mock_pds service.
- Introduced a new Mock PDS Lambda function to simulate PDS responses.
- Created an ECR repository for the Mock PDS service with appropriate policies.
- Updated deployment workflows to include mock_pds in build flags and image overrides.
- Enhanced infrastructure configuration to support the new Mock PDS service, including image URI handling and environment variable setup.
Comment thread .github/workflows/deploy-backend.yml
Thomas-Boyle
Thomas-Boyle previously approved these changes Apr 22, 2026
Comment thread lambdas/mock_pds/pyproject.toml Outdated
Comment thread infrastructure/instance/mock_pds.tf Outdated
Comment thread .github/workflows/deploy-backend.yml Outdated
Comment thread lambdas/mock_pds/src/mock_pds_service.py Outdated
Comment thread lambdas/mock_pds/src/mock_pds_service.py Outdated
Comment thread .github/workflows/quality-checks.yml Outdated
Comment thread lambdas/shared/src/common/api_clients/get_pds_details.py Outdated
Copy link
Copy Markdown
Contributor

@avshetty1980 avshetty1980 left a comment

Choose a reason for hiding this comment

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

Nice, just a few nits.
I like the average + spike rate limiting with Redis atomicity per window

Comment thread lambdas/mock_pds/Dockerfile Fixed
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

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

Labels

feature New feature or request infrastructure Pull requests that update terraform code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants