8000 Eng 432 lambda renaming by RamilGaripov · Pull Request #4094 · metriport/metriport · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Eng 432 lambda renaming #4094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 25, 2025
Merged

Eng 432 lambda renaming #4094

merged 2 commits into from
Jun 25, 2025

Conversation

RamilGaripov
Copy link
Contributor
@RamilGaripov RamilGaripov commented Jun 25, 2025

Issues:

Dependencies

Description

  • Renaming scheduled lambda and updating config correspondingly

Testing

imo, N/A

Release Plan

  • Upstream dependencies are met/released
  • Merge this

Summary by CodeRabbit

  • New Features

    • Introduced support for contributing EHR resource diff bundles, including new Lambda functions, SQS queues, and supporting interfaces.
    • Added ability to fetch and process FHIR resource bundles by resource ID for Athenahealth, Canvas, and Elation EHRs.
    • Implemented direct and cloud-based FHIR conversion handlers, with environment-based handler selection and S3 integration.
    • Added support for CCDA document handling and conversion in Elation EHR integration.
    • Enhanced TCM encounter records with a new optional free-text note field.
  • Improvements

    • Expanded ESLint rules with a new plugin and enforced usage across multiple packages.
    • Improved environment variable management and configuration handling.
    • Enhanced error handling and resource cleanup for OpenSearch integrations.
    • Standardized SQS message parsing and validation using shared utilities.
    • Refined EHR bundle partitioning, reference resource handling, and caching logic.
  • Bug Fixes

    • Fixed resource deduplication and validation in FHIR bundle processing.
    • Corrected concurrency and grouping logic for EHR job processing.
  • Documentation

    • Updated deployment instructions and configuration documentation.
  • Chores

    • Added new optional and development dependencies to support infrastructure and linting.
    • Introduced a new ESLint rules package with configuration and documentation.
  • Style

    • Refactored function declarations for consistency and maintainability across the codebase.
  • Tests

    • Updated test factories to support new TCM encounter properties.

This release brings enhanced interoperability, improved developer tooling, and greater reliability in EHR data processing workflows.

Part of ENG-432

Signed-off-by: Ramil Garipov <ramil@metriport.com>
Copy link
linear bot commented Jun 25, 2025

Copy link
coderabbitai bot commented Jun 25, 2025

Caution

Review failed

Failed to post review comments.

Walkthrough

This change introduces a new Lambda and SQS queue for contributing EHR resource diff bundles, integrates this contribution step into the existing compute resource diff bundles workflow, and adds related configuration and environment variable support. It also adds support for Elation EHR, refines FHIR conversion handling, updates ESLint rules, and makes various schema, model, and infrastructure adjustments.

Changes

Files / Areas Change Summary
Infra & Config
packages/infra/config/env-config.ts, example.ts
package.json
packages/infra/package.json
Renamed job scheduler config properties, added FHIR conversion bucket config, updated workspace/package dependencies, and added optional dependencies for esbuild.
Infra: Stack & Lambda
packages/infra/lib/api-stack.ts, fhir-converter-service.ts, jobs/jobs-scheduler.ts, ehr-nested-stack.ts, api-stack/ccda-search-connector.ts
Added new Lambda and SQS queue for contributing resource diff bundles, integrated with compute resource diff bundles, extended FHIR converter service with Lambda and S3 bucket, updated stack constructors and alarm configuration, and added job scheduler Lambda.
FHIR Converter Lambda
packages/fhir-converter/src/ccda-to-fhir-lambda-nodelambda.js
Added Node.js Lambda handler for CCDA to FHIR conversion, including template caching, error handling, and context management.
Core: FHIR Conversion
packages/core/src/command/conversion-fhir/conversion-fhir.ts, conversion-fhir-factory.ts, conversion-fhir-cloud.ts, conversion-fhir-direct.ts, utils.ts
Introduced abstract FHIR conversion handler, factory for direct/cloud selection, cloud and direct conversion implementations, and supporting utilities for payload partitioning and S3 storage.
Core: EHR Resource Diff Bundles
packages/core/src/external/ehr/job/create-resource-diff-bundles/steps/contribute/, steps/compute/, steps/refresh/*, steps/contribute/ehr-contribute-resource-diff-bundles-factory.ts, ehr-contribute-resource-diff-bundles.ts, shared.ts, command/get-bundle-by-resource-type.ts, command/get-resource-bundle-by-resource-id.ts, bundle/bundle-shared.ts, bundle/command/create-or-replace-bundle.ts, bundle/command/create-or-replace-ccda.ts, bundle/command/fetch-bundle.ts, bundle/command/fetch-bundle.ts
Added direct/cloud handlers for contributing resource diff bundles, refactored compute/refresh handlers, extended bundle key logic, added CCDA file handling, updated fetch/create logic to support resourceId, and improved partitioning and validation.
Core: EHR Integration - Athena, Canvas, Elation
packages/core/src/external/ehr/athenahealth/index.ts, command/get-resource-bundle-by-resource-id.ts, canvas/index.ts, elation/index.ts, elation/command/get-bundle-by-resource-type.ts, elation/command/get-resource-bundle-by-resource-id.ts
Added/extended support for fetching resource bundles by resource ID for Athena, Canvas, and Elation; added CCDA document handling and bundle partitioning for Elation; updated supported resource types and path construction.
Core: Misc/Shared
packages/core/src/command/hl7v2-subscriptions/hl7v2-to-fhir-conversion/shared.ts, util/config.ts, domain/conversion/filename.ts, external/fhir/bundle/bundle.ts, external/fhir/shared/extensions/derived-from.ts, external/fhir/shared/extensions/extension.ts
Added HL7 coding system mapping, new config getters, conversion filename utilities, batch bundle builder, predecessor extension, and data source extension creator.
Core: OpenSearch
packages/core/src/external/opensearch/*
Added try-finally blocks to ensure OpenSearch client closure and error logging in all ingestion, deletion, and search operations.
API: EHR Resource Diff Contribution
packages/api/src/external/ehr/shared/command/bundle/contribute-resource-diff-bundle.ts, routes/internal/ehr/patient.ts, external/ehr/shared/utils/bundle/types.ts
Added API endpoint and handler for contributing resource diff bundles, introduced supporting types, and updated API route to use new handler.
API: TCM Encounter freetextNote
packages/api/src/domain/medical/tcm-encounter.ts, models/medical/tcm-encounter.ts, routes/medical/schemas/tcm-encounter.ts, src/domain/medical/tests/tcm-encounter.ts, command/medical/tcm-encounter/create-sample-tcm-encounter.ts, src/sequelize/migrations/2025-06-21_00_alter-tcm-encounter-add-freetext-note.ts
Added freetextNote property to TcmEncounter interface, schema, model, sample creation, and migration.
API: Misc
src/app.ts, src/external/ehr/shared/utils/appointment.ts, src/external/ehr/shared/job/bundle/create-resource-diff-bundles/start-jobs-across-ehrs.ts, src/external/cda/generate-ccd.ts
Minor comment, constant value, and logic updates; added Elation support to job starter, and deduplication step to CCD generation.
API: ESLint
packages/api/.eslintrc.js, package.json
packages/core/.eslintrc.js, package.json
packages/shared/.eslintrc.js, package.json
packages/mllp-server/.eslintrc.js, package.json
Integrated new @metriport/eslint-rules plugin and recommended config across multiple packages.
ESLint Plugin
packages/eslint-rules/*
Added new ESLint rule (no-named-arrow-functions), plugin index, rule index, recommended and all configs, and package.json for the ESLint plugin.
Lambdas
packages/lambdas/src/ehr/compute-resource-diff-bundles.ts, contribute-resource-diff-bundles.ts, elation/link-patient.ts, healthie/link-patient.ts, refresh-ehr-bundles.ts, sync-patient.ts, job/patient/run-job.ts, shared/parse-body.ts, shared/sqs.ts, surescripts/*
Refactored Lambda handlers to use new capture wrapper, unified and centralized body parsing with schema validation, updated handler implementations to use new direct handler classes, and separated parseBody utility from SQS helpers.
Shared
src/common/env-var.ts, general.ts, util/uuid-v7.ts, interface/external/ehr/elation/ccda.ts, interface/external/ehr/elation/index.ts, src/common/tests/retry.test.ts
Refactored utility functions to named declarations, added integer env var parser, added CCDA schema/type for Elation, and minor test function style update.
Workflows & Docs
.github/workflows/_deploy-hl7-notification-cdk.yml, packages/lambdas/README.md
Added FHIR converter dependency install step to workflow and fixed local lambda deployment doc command.

Sequence Diagram(s)

sequenceDiagram
    participant API
    participant Lambda_Compute
    participant SQS_Contribute
    participant Lambda_Contribute
    participant EHR_System
    participant S3

    API->>Lambda_Compute: Trigger compute resource diff bundles
    Lambda_Compute->>SQS_Contribute: Send message to contribute queue
    SQS_Contribute->>Lambda_Contribute: Trigger contribute handler
    Lambda_Contribute->>S3: Fetch EHR-only resources bundle
    Lambda_Contribute->>EHR_System: Hydrate references (multiple requests)
    Lambda_Contribute->>EHR_System: Contribute hydrated resource diff bundle
    Lambda_Contribute->>S3: Store result/status
Loading
sequenceDiagram
    participant User
    participant API
    participant Lambda_FHIR_Converter
    participant S3

    User->>API: Request FHIR conversion (CCDA input)
    API->>Lambda_FHIR_Converter: Invoke Lambda with CCDA payload
    Lambda_FHIR_Converter->>S3: Read templates and/or payloads
    Lambda_FHIR_Converter-->>API: Return FHIR bundle
    API-->>User: Return FHIR bundle
Loading

Possibly related PRs

  • #4087: Introduces the contributeResourceDiffBundle function and related API route to handle the contribution of resource diff bundles, which is directly used by the new Lambda and queue in this PR.
  • #4090: Adds comprehensive support for Elation EHR source handling, including new methods for fetching resource bundles by resource ID and integrating Elation into resource diff bundle workflows, overlapping with the Elation integration in this PR.
  • #3891: Adds the core contribution workflow logic including the contributeResourceDiffBundle function, API route, and direct/cloud handlers for contributing resource diff bundles, which are orchestrated by the infrastructure and Lambda setup in this PR.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error code ERR_SSL_WRONG_VERSION_NUMBER
npm error errno ERR_SSL_WRONG_VERSION_NUMBER
npm error request to https://10.0.0.28:4873/punycode/-/punycode-2.3.1.tgz failed, reason: C06C4D43937F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
npm error
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-25T20_49_22_470Z-debug-0.log

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/core/src/command/patient-import/api/update-job-status.ts (1)

7-7: Same aliasing concern as noted in create-patient-mapping.ts – favour a path alias (e.g. @core/shared/api) rather than ../../shared/api/shared.

packages/core/src/command/patient-import/api/create-patient.ts (1)

4-4: Same aliasing concern as noted earlier – deep relative paths are brittle; suggest switching to an alias import.

🧹 Nitpick comments (1)
packages/core/src/command/patient-import/api/create-patient-mapping.ts (1)

4-4: Prefer path alias over deep relative import

Jumping three directories (../../) is brittle and fragile to future refactors.
Consider exposing withDefaultApiErrorHandling through a barrel export (e.g. @core/shared/api) and reference it via the ts-config paths mapping:

-import { withDefaultApiErrorHandling } from "../../shared/api/shared";
+import { withDefaultApiErrorHandling } from "@core/shared/api";

This keeps imports stable, short, and aligned with the onion-layer guideline of minimizing coupling to file structure.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44c74e9 and 124d9b0.

📒 Files selected for processing (13)
  • packages/api/src/routes/internal/medical/patient-job.ts (1 hunks)
  • packages/core/src/command/patient-import/api/create-patient-mapping.ts (1 hunks)
  • packages/core/src/command/patient-import/api/create-patient.ts (1 hunks)
  • packages/core/src/command/patient-import/api/update-job-status.ts (1 hunks)
  • packages/core/src/command/patient-import/patient-import-shared.ts (1 hunks)
  • packages/core/src/command/patient-import/steps/query/patient-import-query-local.ts (3 hunks)
  • packages/core/src/command/shared/api/start-document-query.ts (1 hunks)
  • packages/core/src/command/shared/api/start-patient-query.ts (2 hunks)
  • packages/infra/config/env-config.ts (1 hunks)
  • packages/infra/config/example.ts (1 hunks)
  • packages/infra/lib/api-stack.ts (2 hunks)
  • packages/infra/lib/jobs/jobs-scheduler.ts (1 hunks)
  • packages/infra/lib/jobs/jobs-stack.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/infra/lib/jobs/jobs-stack.ts
🧰 Additional context used
📓 Path-based instructions (2)
`**/*`: Use eslint to enforce code style Use prettier to format code Max column ...

**/*: Use eslint to enforce code style
Use prettier to format code
Max column length is 100 chars
Multi-line comments use /** */
Top-level comments go after the import (save pre-import to basic file header, like license)
Move literals to constants declared after imports when possible
File names: kebab-case

📄 Source: CodeRabbit Inference Engine (.cursorrules)

List of files the instruction was applied to:

  • packages/core/src/command/patient-import/api/create-patient.ts
  • packages/core/src/command/patient-import/api/create-patient-mapping.ts
  • packages/core/src/command/patient-import/api/update-job-status.ts
  • packages/core/src/command/patient-import/patient-import-shared.ts
  • packages/infra/config/example.ts
  • packages/api/src/routes/internal/medical/patient-job.ts
  • packages/infra/lib/api-stack.ts
  • packages/infra/config/env-config.ts
  • packages/core/src/command/patient-import/steps/query/patient-import-query-local.ts
  • packages/core/src/command/shared/api/start-document-query.ts
  • packages/infra/lib/jobs/jobs-scheduler.ts
  • packages/core/src/command/shared/api/start-patient-query.ts
`**/*.ts`: - Use the Onion Pattern to organize a package's code in layers - Try ...

**/*.ts: - Use the Onion Pattern to organize a package's code in layers

  • Try to use immutable code and avoid sharing state across different functions, objects, and systems
  • Try to build code that's idempotent whenever possible
  • Prefer functional programming style functions: small, deterministic, 1 input, 1 output
  • Minimize coupling / dependencies
  • Avoid modifying objects received as parameter
  • Only add comments to code to explain why something was done, not how it works
  • Naming
    • classes, enums: PascalCase
    • constants, variables, functions: camelCase
    • file names: kebab-case
    • 8000
    • table and column names: snake_case
    • Use meaningful names, so whoever is reading the code understands what it means
    • Don’t use negative names, like notEnabled, prefer isDisabled
    • For numeric values, if the type doesn’t convey the unit, add the unit to the name
  • Typescript
    • Use types
    • Prefer const instead of let
    • Avoid any and casting from any to other types
    • Type predicates: only applicable to narrow down the type, not to force a complete type conversion
    • Prefer deconstructing parameters for functions instead of multiple parameters that might be of
      the same type
    • Don’t use null inside the app, only on code interacting with external interfaces/services,
      like DB and HTTP; convert to undefined before sending inwards into the code
    • Use async/await instead of .then()
    • Use the strict equality operator ===, don’t use abstract equality operator ==
    • When calling a Promise-returning function asynchronously (i.e., not awaiting), use .catch() to
      handle errors (see processAsyncError and emptyFunction depending on the case)
    • Date and Time
      • Always use buildDayjs() to create dayjs instances
      • Prefer dayjs.duration(...) to create duration consts and keep them as duration
  • Prefer Nullish Coalesce (??) than the OR operator (||) to provide a default value
  • Avoid creating arrow functions
  • Use truthy syntax instead of in - i.e., if (data.link) not if ('link' in data)
  • Error handling
    • Pass the original error as the new one’s cause so the stack trace is persisted
    • Error messages should have a static message - add dynamic data to MetriportError's additionalInfo prop
    • Avoid sending multiple events to Sentry for a single error
  • Global constants and variables
    • Move literals to constants declared after imports when possible (avoid magic numbers)
    • Avoid shared, global objects
  • Avoid using console.log and console.error in packages other than utils, infra and shared,
    and try to use out().log instead
  • Avoid multi-line logs
    • don't send objects as a second parameter to console.log() or out().log()
    • don't create multi-line strings when using JSON.stringify()
  • Use eslint to enforce code style
  • Use prettier to format code
  • max column length is 100 chars
  • multi-line comments use /** */
  • scripts: top-level comments go after the import

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • packages/core/src/command/patient-import/api/create-patient.ts
  • packages/core/src/command/patient-import/api/create-patient-mapping.ts
  • packages/core/src/command/patient-import/api/update-job-status.ts
  • packages/core/src/command/patient-import/patient-import-shared.ts
  • packages/infra/config/example.ts
  • packages/api/src/routes/internal/medical/patient-job.ts
  • packages/infra/lib/api-stack.ts
  • packages/infra/config/env-config.ts
  • packages/core/src/command/patient-import/steps/query/patient-import-query-local.ts
  • packages/core/src/command/shared/api/start-document-query.ts
  • packages/infra/lib/jobs/jobs-scheduler.ts
  • packages/core/src/command/shared/api/start-patient-query.ts
🧠 Learnings (1)
packages/api/src/routes/internal/medical/patient-job.ts (1)
Learnt from: RamilGaripov
PR: metriport/metriport#3976
File: packages/api/src/routes/medical/patient.ts:541-543
Timestamp: 2025-06-18T21:05:22.256Z
Learning: In packages/api/src/routes/medical/patient.ts, inline schema definitions like cohortIdSchema are acceptable and don't need to be moved to separate schema files when the user prefers to keep them inline.
🧬 Code Graph Analysis (5)
packages/infra/lib/api-stack.ts (1)
packages/infra/lib/jobs/jobs-scheduler.ts (1)
  • createJobsScheduler (27-48)
packages/core/src/command/patient-import/steps/query/patient-import-query-local.ts (1)
packages/core/src/command/patient-import/patient-import-shared.ts (1)
  • patientImportContext (4-4)
packages/core/src/command/shared/api/start-document-query.ts (1)
packages/core/src/command/shared/api/shared.ts (1)
  • withDefaultApiErrorHandling (24-53)
packages/infra/lib/jobs/jobs-scheduler.ts (4)
packages/infra/lib/shared/lambda-layers.ts (1)
  • LambdaLayers (16-16)
packages/infra/config/example.ts (1)
  • config (8-235)
packages/infra/config/env-config.ts (1)
  • EnvConfig (311-311)
packages/infra/lib/shared/lambda-scheduled.ts (1)
  • createScheduledLambda (28-61)
packages/core/src/command/shared/api/start-patient-query.ts (1)
packages/core/src/command/shared/api/shared.ts (1)
  • withDefaultApiErrorHandling (24-53)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (20)
packages/core/src/command/patient-import/patient-import-shared.ts (1)

4-4: LGTM! Well-structured constant addition.

The new patientImportContext constant follows proper naming conventions and provides a clear, reusable context identifier for patient import operations.

packages/infra/config/example.ts (1)

232-233: LGTM! Improved property naming clarity.

The renaming of job scheduler properties enhances readability by making the "scheduled" aspect more prominent in the property names while maintaining consistency with the type definitions.

packages/infra/lib/api-stack.ts (2)

49-49: LGTM! Clean import addition.

The import follows established patterns and integrates the new job scheduler functionality.


740-746: LGTM! Proper integration pattern.

The createJobsScheduler function call follows the same pattern as other scheduled task integrations in the constructor, with appropriate parameter passing and placement alongside similar functionality.

packages/api/src/routes/internal/medical/patient-job.ts (1)

248-248: Verify that making the data field required won't break existing API calls.

Making a previously optional schema field required is a breaking change. Please ensure that all callers of this endpoint have been updated to include the data field in their request bodies.

Run the following script to verify all API calls to this endpoint include the data field:

#!/bin/bash
# Description: Search for API calls to the runtime data update endpoint to verify data field usage

# Search for calls to the runtime data endpoint
echo "Searching for API calls to runtime-data endpoint..."
rg -A 10 -B 5 "runtime-data" --type ts --type js

# Search for potential API client usage
echo "Searching for updatePatientJobRuntimeData function calls..."
rg -A 5 -B 5 "updatePatientJobRuntimeData" --type ts --type js

# Search for fetch/axios calls to this endpoint
echo "Searching for HTTP calls to patient job endpoints..."
rg -A 10 "POST.*patient.*job.*runtime-data" --type ts --type js
packages/infra/config/env-config.ts (1)

285-286: LGTM! Consistent type definition updates.

The property renaming maintains consistency with the example configuration and improves clarity by emphasizing the "scheduled" nature of these job-related properties.

packages/core/src/command/patient-import/steps/query/patient-import-query-local.ts (3)

7-9: LGTM: Import updates are consistent with the API refactoring

The import path updates and addition of patientImportContext align well with the centralized context management approach.


39-39: Good: Context parameter properly integrated

The patientImportContext is correctly passed to both API calls, providing consistent context for error handling and logging across the patient import workflow.

Also applies to: 48-48


52-56: Good: Dynamic context in error messages

The error logging now uses the dynamic patientImportContext instead of hardcoded strings, improving consistency and maintainability.

packages/core/src/command/shared/api/start-document-query.ts (3)

14-14: LGTM: Context parameter properly integrated

The addition of the required context parameter enhances error handling and logging capabilities. The function signature change is well-documented and consistent with the companion startPatientQuery function.

Also applies to: 22-22, 29-30


37-37: Good: Dynamic context in error handling

The error messages and additional info now properly incorporate the context parameter, providing better traceability and debugging information.

Also applies to: 43-43


30-30: Verify impact of return type change

The function now returns { requestId: string } instead of void. While this provides useful tracking information, ensure all callers can handle the new return type.

#!/bin/bash
# Description: Verify all callers of startDocumentQuery can handle the new return type
# Expected: Callers either ignore the return value or properly handle the object structure

echo "Searching for startDocumentQuery usage patterns..."
rg -A 3 -B 1 'startDocumentQuery\(' --type ts

Also applies to: 47-47

packages/core/src/command/shared/api/start-patient-query.ts (3)

6-6: Good: Improved documentation clarity

The documentation now explicitly mentions "patient discovery query" which provides better clarity about the function's purpose.

Also applies to: 12-13


20-21: LGTM: Consistent context parameter integration

The context parameter is properly integrated, matching the pattern established in startDocumentQuery. This ensures consistent error handling across both API functions.

Also applies to: 26-27


38-38: Good: Consistent error handling and return type

The error handling and return type changes are consistent with startDocumentQuery, maintaining a uniform API pattern across related functions.

Also applies to: 44-44, 48-48

packages/infra/lib/jobs/jobs-scheduler.ts (5)

10-16: LGTM: Well-defined props interface

The JobsSchedulerProps type clearly defines all required dependencies with appropriate CDK types and optional alarm configuration.


18-25: Good: Clean configuration merging

The getSettings helper function cleanly merges props with configuration, maintaining separation of concerns and making the main function more readable.


31-47: LGTM: Proper Lambda creation with all required parameters

The function correctly passes all necessary parameters to createScheduledLambda, including the shared layer, VPC configuration, and alarm action. The destructuring approach keeps the code clean and readable.


27-29: Ensure undefined return value is handled by callers

The function returns undefined when config.jobs is missing. Verify that all callers properly handle this case.

#!/bin/bash
# Description: Find all callers of createJobsScheduler to verify undefined handling
# Expected: Callers should either check for undefined or handle it gracefully

echo "Searching for createJobsScheduler usage..."
rg -A 5 -B 2 'createJobsScheduler\(' --type ts

23-23: Verify HTTP usage for internal communication

The URL construction uses http:// for internal API communication. Ensure this is appropriate for your infrastructure security requirements.

What are the security best practices for internal AWS Lambda to API communication? Should HTTPS be used even for internal VPC communication?

@RamilGaripov RamilGaripov changed the base branch from develop to eng-433-moving-files June 25, 2025 20:42
…t/metriport into eng-432-lambda-renaming

Signed-off-by: Thomas Yopes <thomasyopes@Thomass-MBP.attlocal.net>
@thomasyopes thomasyopes changed the base branch from eng-433-moving-files to develop June 25, 2025 20:49
@thomasyopes thomasyopes changed the base branch from develop to eng-433-moving-files June 25, 2025 20:49
Base automatically changed from eng-433-moving-files to develop June 25, 2025 20:56
@RamilGaripov RamilGaripov added this pull request to the merge queue Jun 25, 2025
Merged via the queue into develop with commit 51ea782 Jun 25, 2025
27 checks passed
@RamilGaripov RamilGaripov deleted the eng-432-lambda-renaming branch June 25, 2025 21:10
@RamilGaripov RamilGaripov mentioned this pull request Jun 26, 2025
3 tasks
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
0