8000 RELEASE: Conversion type mandatory + misc by Orta21 · Pull Request #3895 · metriport/metriport · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

RELEASE: Conversion type mandatory + misc #3895

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 23 commits into from
May 26, 2025
Merged

RELEASE: Conversion type mandatory + misc #3895

merged 23 commits into from
May 26, 2025

Conversation

Orta21
Copy link
Member
@Orta21 Orta21 commented May 26, 2025

Issues:

Dependencies

  • Upstream: none
  • Downstream: none

Description

Testing

Check each PR.

Release Plan

  • ⚠️ Points to master
  • Release NPM packages
  • Merge this

Summary by CodeRabbit

  • New Features

    • The conversionType parameter is now required for consolidated patient queries and supports "json", "html", and "pdf" formats.
    • The webhook payload for consolidated queries always includes a signed URL valid for 3 minutes.
  • Bug Fixes

    • Fixed HTML attribute syntax in medication tables for improved display in generated documents.
  • Removals

    • The /search-summary API endpoint and related AI brief and summarization utilities have been removed.
  • Chores

    • Updated multiple package versions and dependencies across the project.

Orta21 added 19 commits May 12, 2025 17:57
Part of cs-39

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-322

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-39

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-39

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-231

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-231

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-231

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-331

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-231

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Ref: #000

 - api@1.27.4-alpha.0
 - @metriport/api-sdk@14.14.4-alpha.0
 - @metriport/carequality-cert-runner@1.18.4-alpha.0
 - @metriport/carequality-sdk@1.6.4-alpha.0
 - @metriport/commonwell-cert-runner@1.26.4-alpha.0
 - @metriport/commonwell-jwt-maker@1.24.4-alpha.0
 - @metriport/commonwell-sdk@5.9.2-alpha.0
 - @metriport/core@1.24.4-alpha.0
 - @metriport/ihe-gateway-sdk@0.19.4-alpha.0
 - infrastructure@1.22.4-alpha.0
 - mllp-server@0.3.4-alpha.0
 - @metriport/shared@0.23.4-alpha.0
 - utils@1.25.4-alpha.0

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Ref: #000

 - api@1.27.5-alpha.0
 - @metriport/api-sdk@14.14.5-alpha.0
 - @metriport/carequality-cert-runner@1.18.5-alpha.0
 - @metriport/carequality-sdk@1.6.5-alpha.0
 - @metriport/commonwell-cert-runner@1.26.5-alpha.0
 - @metriport/commonwell-jwt-maker@1.24.5-alpha.0
 - @metriport/commonwell-sdk@5.9.3-alpha.0
 - @metriport/core@1.24.5-alpha.0
 - @metriport/ihe-gateway-sdk@0.19.5-alpha.0
 - infrastructure@1.22.5-alpha.0
 - mllp-server@0.3.5-alpha.0
 - @metriport/shared@0.23.5-alpha.0
 - utils@1.25.5-alpha.0

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-231

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Ref: #000

 - @metriport/api-sdk@15.0.0-alpha.0

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-231

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Part of eng-231

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Copy link
coderabbitai bot commented May 26, 2025

Walkthrough

This change enforces that the conversionType parameter is required rather than optional across the API, SDK, schemas, and tests, and expands its allowed values to include "json" in addition to "pdf" and "html". Related documentation, request handling, and type definitions are updated to reflect and enforce this requirement. Some legacy AI summarization code and routes are removed.

Changes

File(s) Change Summary
docs/_snippets/consolidated-query.mdx Documentation snippet updated: conversionType changed from optional to required in response schema.
fern/definition/medical/fhir.yml API spec: conversionType moved to required query param, allowed values expanded, example added.
packages/api-sdk/package.json
packages/api/package.json
packages/carequality-cert-runner/package.json
packages/carequality-sdk/package.json
packages/commonwell-cert-runner/package.json
packages/commonwell-jwt-maker/package.json
packages/commonwell-sdk/package.json
packages/core/package.json
packages/ihe-gateway-sdk/package.json
packages/infra/package.json
packages/mllp-server/package.json
packages/shared/package.json
packages/utils/package.json
Package versions bumped to new alpha versions; some dependencies updated to alpha versions.
packages/api-sdk/src/medical/client/metriport.ts Method signature for startConsolidatedQuery: conversionType now defaults to "json"; JSDoc updated.
packages/api-sdk/src/medical/models/fhir.ts Schema: conversionType made required (no longer optional, no default).
packages/api/src/command/medical/patient/tests/consolidated-get.test.ts Tests: Pass explicit { conversionType: "json" } instead of {} in test arguments.
packages/api/src/command/medical/patient/tests/get-consolidated-webhook.test.ts Test for missing/invalid conversionType removed.
packages/api/src/command/medical/patient/tests/store-query-cmd.ts Test data/factory: Always set conversionType to "json" by default.
packages/api/src/command/medical/patient/consolidated-get.ts Logic: Condition for medical record creation simplified; import order changed.
packages/api/src/routes/internal/medical/patient.ts Route: /internal/patient/consolidated now requires conversionType query param; "json" accepted.
packages/api/src/routes/medical/patient.ts Route: /patient/:id/consolidated/query now requires conversionType; docs updated.
packages/api/src/routes/medical/document.ts Route: /search-summary POST handler and validation removed.
packages/core/src/command/consolidated/consolidated-get.ts Function: getConsolidatedPatientDataAsync now requires conversionType argument.
packages/core/src/command/consolidated/get-snapshot.ts Type: ConsolidatedSnapshotRequestAsync's conversionType property made required.
packages/core/src/command/search-summary/brief.ts
packages/core/src/command/search-summary/filter.ts
packages/core/src/command/search-summary/shared.ts
AI brief and bundle filtering utilities deleted.
packages/core/src/command/search-summary/create.ts Imports, JSDoc, and error handling improved; parseSummaryWithCitations signature updated.
packages/core/src/external/aws/lambda-logic/bundle-to-html-adhd.ts
packages/core/src/external/aws/lambda-logic/bundle-to-html-derm.ts
packages/core/src/external/aws/lambda-logic/bundle-to-html.ts
HTML template syntax error fixed in medication section (data-id attribute).
packages/shared/src/interface/internal/consolidated.ts Schema: conversionType property made required in internalSendConsolidatedSchema.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Core
    participant DB

    Client->>API: POST /patient/:id/consolidated/query?conversionType={type}
    API->>API: Validate required conversionType ("json", "html", "pdf")
    API->>Core: getConsolidatedPatientDataAsync(..., conversionType)
    Core->>DB: Fetch patient/resource data
    Core-->>API: Consolidated data (format depends on conversionType)
    API-->>Client: Response (includes conversionType in schema)
Loading

Possibly related PRs

  • build: conversiontype required #3884: The main PR and the retrieved PR both make the conversionType field required across multiple layers including documentation snippets, API endpoint query parameters, method signatures, schema validations, and test data, indicating they are directly related changes enforcing the same requirement.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 02331a5 and 65bd6c6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • packages/api-sdk/package.json (3 hunks)
  • packages/api/package.json (1 hunks)
  • packages/carequality-cert-runner/package.json (2 hunks)
  • packages/carequality-sdk/package.json (1 hunks)
  • packages/commonwell-cert-runner/package.json (2 hunks)
  • packages/commonwell-jwt-maker/package.json (2 hunks)
  • packages/commonwell-sdk/package.json (2 hunks)
  • packages/core/package.json (1 hunks)
  • packages/ihe-gateway-sdk/package.json (2 hunks)
  • packages/infra/package.json (1 hunks)
  • packages/mllp-server/package.json (1 hunks)
  • packages/shared/package.json (1 hunks)
  • packages/utils/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/infra/package.json
🚧 Files skipped from review as they are similar to previous changes (12)
  • packages/mllp-server/package.json
  • packages/utils/package.json
  • packages/core/package.json
  • packages/shared/package.json
  • packages/api/package.json
  • packages/commonwell-sdk/package.json
  • packages/carequality-sdk/package.json
  • packages/ihe-gateway-sdk/package.json
  • packages/commonwell-cert-runner/package.json
  • packages/carequality-cert-runner/package.json
  • packages/commonwell-jwt-maker/package.json
  • packages/api-sdk/package.json
⏰ Context from checks skipped due to timeout of 90000ms (36)
  • GitHub Check: ihe_stack / deploy
  • GitHub Check: location_services_cdk_stack / deploy
  • GitHub Check: secrets_cdk_stack / deploy
  • GitHub Check: mllp-server / deploy
  • GitHub Check: infra-hl7-notification / deploy
  • GitHub Check: api / deploy
  • GitHub Check: infra-api-lambdas / deploy
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • 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)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test

🪧 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.

Orta21 added 3 commits May 26, 2025 12:14
Ref: #000

 - @metriport/api-sdk@15.0.0

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Ref: #000

 - api@1.27.5
 - @metriport/api-sdk@15.0.0
 - @metriport/carequality-cert-runner@1.18.5
 - @metriport/carequality-sdk@1.6.5
 - @metriport/commonwell-cert-runner@1.26.5
 - @metriport/commonwell-jwt-maker@1.24.5
 - @metriport/commonwell-sdk@5.9.3
 - @metriport/core@1.24.5
 - @metriport/ihe-gateway-sdk@0.19.5
 - infrastructure@1.22.5
 - mllp-server@0.3.5
 - @metriport/shared@0.23.5
 - utils@1.25.5

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
Ref: #000

 - api@1.27.6
 - @metriport/api-sdk@15.0.1
 - @metriport/carequality-cert-runner@1.18.6
 - @metriport/carequality-sdk@1.6.6
 - @metriport/commonwell-cert-runner@1.26.6
 - @metriport/commonwell-jwt-maker@1.24.6
 - @metriport/commonwell-sdk@5.9.4
 - @metriport/core@1.24.6
 - @metriport/ihe-gateway-sdk@0.19.6
 - infrastructure@1.22.6
 - mllp-server@0.3.6
 - @metriport/shared@0.23.6
 - utils@1.25.6

Signed-off-by: Jorge Orta <36802074+Orta21@users.noreply.github.com>
@Orta21 Orta21 marked this pull request as ready for review May 26, 2025 16:36
@Orta21 Orta21 requested a review from lucasdellabella as a code owner May 26, 2025 16:36
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: 4

🧹 Nitpick comments (1)
packages/api-sdk/src/medical/client/metriport.ts (1)

487-488: Update JSDoc to reflect the required nature of the parameter.

While the JSDoc describes conversionType as "Optional", the broader PR context indicates this parameter is becoming required across the API. Consider updating the JSDoc to reflect this change more accurately, perhaps as "The conversion type for the medical record rendering" rather than "Optional to indicate...".

-   * @param conversionType Optional to indicate how the medical record should be rendered - one of:
+   * @param conversionType The conversion type for how the medical record should be rendered - one of:
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0f91b73 and 02331a5.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (34)
  • docs/_snippets/consolidated-query.mdx (1 hunks)
  • fern/definition/medical/fhir.yml (3 hunks)
  • packages/api-sdk/package.json (2 hunks)
  • packages/api-sdk/src/medical/client/metriport.ts (2 hunks)
  • packages/api-sdk/src/medical/models/fhir.ts (1 hunks)
  • packages/api/package.json (1 hunks)
  • packages/api/src/command/medical/patient/__tests__/consolidated-get.test.ts (2 hunks)
  • packages/api/src/command/medical/patient/__tests__/get-consolidated-webhook.test.ts (0 hunks)
  • packages/api/src/command/medical/patient/__tests__/store-query-cmd.ts (2 hunks)
  • packages/api/src/command/medical/patient/consolidated-get.ts (2 hunks)
  • packages/api/src/routes/internal/medical/patient.ts (2 hunks)
  • packages/api/src/routes/medical/document.ts (0 hunks)
  • packages/api/src/routes/medical/patient.ts (2 hunks)
  • packages/carequality-cert-runner/package.json (2 hunks)
  • packages/carequality-sdk/package.json (1 hunks)
  • packages/commonwell-cert-runner/package.json (2 hunks)
  • packages/commonwell-jwt-maker/package.json (2 hunks)
  • packages/commonwell-sdk/package.json (2 hunks)
  • packages/core/package.json (1 hunks)
  • packages/core/src/command/consolidated/consolidated-get.ts (1 hunks)
  • packages/core/src/command/consolidated/get-snapshot.ts (1 hunks)
  • packages/core/src/command/search-summary/brief.ts (0 hunks)
  • packages/core/src/command/search-summary/create.ts (5 hunks)
  • packages/core/src/command/search-summary/filter.ts (0 hunks)
  • packages/core/src/command/search-summary/shared.ts (0 hunks)
  • packages/core/src/external/aws/lambda-logic/bundle-to-html-adhd.ts (1 hunks)
  • packages/core/src/external/aws/lambda-logic/bundle-to-html-derm.ts (1 hunks)
  • packages/core/src/external/aws/lambda-logic/bundle-to-html.ts (1 hunks)
  • packages/ihe-gateway-sdk/package.json (2 hunks)
  • packages/infra/package.json (1 hunks)
  • packages/mllp-server/package.json (1 hunks)
  • packages/shared/package.json (1 hunks)
  • packages/shared/src/interface/internal/consolidated.ts (1 hunks)
  • packages/utils/package.json (1 hunks)
💤 Files with no reviewable changes (5)
  • packages/api/src/command/medical/patient/tests/get-consolidated-webhook.test.ts
  • packages/api/src/routes/medical/document.ts
  • packages/core/src/command/search-summary/brief.ts
  • packages/core/src/command/search-summary/shared.ts
  • packages/core/src/command/search-summary/filter.ts
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.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...

**/*.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
    • 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
  • packages/shared/src/interface/internal/consolidated.ts
  • packages/api-sdk/src/medical/models/fhir.ts
  • packages/api/src/command/medical/patient/__tests__/consolidated-get.test.ts
  • packages/core/src/command/consolidated/get-snapshot.ts
  • packages/core/src/command/consolidated/consolidated-get.ts
  • packages/api/src/routes/medical/patient.ts
  • packages/core/src/external/aws/lambda-logic/bundle-to-html-derm.ts
  • packages/api/src/command/medical/patient/__tests__/store-query-cmd.ts
  • packages/core/src/external/aws/lambda-logic/bundle-to-html.ts
  • packages/core/src/external/aws/lambda-logic/bundle-to-html-adhd.ts
  • packages/api/src/routes/internal/medical/patient.ts
  • packages/api/src/command/medical/patient/consolidated-get.ts
  • packages/core/src/command/search-summary/create.ts
  • packages/api-sdk/src/medical/client/metriport.ts
🧠 Learnings (6)
packages/ihe-gateway-sdk/package.json (1)
Learnt from: leite08
PR: metriport/metriport#3463
File: packages/api-sdk/src/medical/models/patient.ts:1-1
Timestamp: 2025-03-19T13:58:17.253Z
Learning: When changes are made to SDK packages (`api-sdk`, `commonwell-sdk`, `carequality-sdk`) or `packages/shared` in the Metriport codebase, alpha versions need to be published to NPM before merging the PR.
packages/commonwell-sdk/package.json (1)
Learnt from: leite08
PR: metriport/metriport#3463
File: packages/api-sdk/src/medical/models/patient.ts:1-1
Timestamp: 2025-03-19T13:58:17.253Z
Learning: When changes are made to SDK packages (`api-sdk`, `commonwell-sdk`, `carequality-sdk`) or `packages/shared` in the Metriport codebase, alpha versions need to be published to NPM before merging the PR.
packages/api/src/routes/medical/patient.ts (1)
Learnt from: leite08
PR: metriport/metriport#3814
File: packages/api/src/routes/internal/medical/patient-consolidated.ts:141-174
Timestamp: 2025-05-20T21:26:26.804Z
Learning: The functionality introduced in packages/api/src/routes/internal/medical/patient-consolidated.ts is planned to be refactored in downstream PR #3857, including improvements to error handling and validation.
packages/api-sdk/package.json (1)
Learnt from: leite08
PR: metriport/metriport#3463
File: packages/api-sdk/src/medical/models/patient.ts:1-1
Timestamp: 2025-03-19T13:58:17.253Z
Learning: When changes are made to SDK packages (`api-sdk`, `commonwell-sdk`, `carequality-sdk`) or `packages/shared` in the Metriport codebase, alpha versions need to be published to NPM before merging the PR.
packages/api/src/routes/internal/medical/patient.ts (1)
Learnt from: leite08
PR: metriport/metriport#3814
File: packages/api/src/routes/internal/medical/patient-consolidated.ts:141-174
Timestamp: 2025-05-20T21:26:26.804Z
Learning: The functionality introduced in packages/api/src/routes/internal/medical/patient-consolidated.ts is planned to be refactored in downstream PR #3857, including improvements to error handling and validation.
packages/api/src/command/medical/patient/consolidated-get.ts (2)
Learnt from: leite08
PR: metriport/metriport#3814
File: packages/api/src/routes/internal/medical/patient-consolidated.ts:141-174
Timestamp: 2025-05-20T21:26:26.804Z
Learning: The functionality introduced in packages/api/src/routes/internal/medical/patient-consolidated.ts is planned to be refactored in downstream PR #3857, including improvements to error handling and validation.
Learnt from: leite08
PR: metriport/metriport#3814
File: packages/core/src/command/consolidated/search/fhir-resource/search-semantic.ts:36-36
Timestamp: 2025-05-19T13:53:09.828Z
Learning: In the `getConsolidatedPatientData` function from `@metriport/core/command/consolidated/consolidated-get`, only the `patient` parameter is required. Other parameters like `requestId`, `resources`, `dateFrom`, `dateTo`, `fromDashboard`, and `forceDataFromFhir` are all optional.
🧬 Code Graph Analysis (4)
packages/shared/src/interface/internal/consolidated.ts (1)
packages/api-sdk/src/medical/models/fhir.ts (1)
  • consolidationConversionType (20-20)
packages/api/src/command/medical/patient/__tests__/consolidated-get.test.ts (1)
packages/api/src/command/medical/patient/consolidated-get.ts (1)
  • getCurrentConsolidatedProgress (154-174)
packages/core/src/command/consolidated/get-snapshot.ts (1)
packages/api-sdk/src/medical/models/fhir.ts (1)
  • ConsolidationConversionType (21-21)
packages/core/src/command/consolidated/consolidated-get.ts (1)
packages/api-sdk/src/medical/models/fhir.ts (1)
  • ConsolidationConversionType (21-21)
🔇 Additional comments (42)
packages/carequality-sdk/package.json (1)

3-3:

✅ Verification successful

Pre-release version bump
The version has been updated to 1.6.5-alpha.0 to align with the coordinated alpha release across packages. Confirm this aligns with your semver policy for pre-releases and update any dependent docs or workflows still referencing 1.6.3.

Run this to detect any stale references to the old version:


🏁 Script executed:

#!/bin/bash
# Search entire repo for occurrences of the previous version
rg "1\\.6\\.3" -n .

Length of output: 716


Pre-release bump approved
The move to 1.6.5-alpha.0 follows semver pre-release conventions. I didn’t find any stale references to the prior carequality-sdk version outside of auto-generated lockfiles.

• Lockfiles still show 1.6.3 for unrelated deps (express-http-proxy, etc.) – simply re-run npm install to refresh them.
• No docs or CI/workflows reference the old SDK version.

All set to merge.

packages/core/src/command/search-summary/create.ts (7)

5-5: LGTM: Proper error handling import added.

The addition of MetriportError import from @metriport/shared aligns with the coding guidelines for consistent error handling across the codebase.


30-38: Excellent documentation with helpful context.

The JSDoc comment provides comprehensive documentation including the TODO note about production usage, which helps future maintainers understand the current state of this function.


89-89: Good practice: Dependency injection for logging.

Passing the log function as a parameter to parseSummaryWithCitations follows good dependency injection practices and improves testability.


92-92: LGTM: Error message correctly updated.

The error message has been appropriately updated from "AI brief generation failure" to "Search summary generation failure" to match the function's actual purpose.


102-105: Good refactor: Optional logging parameter with sensible default.

The function signature change to accept an optional log parameter with console.log as default follows good practices:

  • Maintains backward compatibility
  • Allows dependency injection for testing
  • Provides sensible default behavior

121-122: Excellent error handling improvement.

The enhanced error handling follows the coding guidelines correctly:

  • Uses the injected logger for consistent logging
  • Wraps the original error in MetriportError with the original error as cause
  • Provides a meaningful static error message

11-11:

✅ Verification successful

Verify the import path change is correct.

The import path has been changed from a local ./filter to ../ai-brief/filter. This suggests code reorganization where filtering functionality has been moved or consolidated.

Please verify that the prepareBundleForAiSummarization function is correctly exported from the new location:


🏁 Script executed:

#!/bin/bash
# Description: Verify the prepareBundleForAiSummarization function exists in the new location
# Expected: Function should be exported from ../ai-brief/filter

ast-grep --pattern 'export $_ prepareBundleForAiSummarization'

Length of output: 64


🏁 Script executed:

#!/bin/bash
# Search for all occurrences of prepareBundleForAiSummarization to verify it’s defined and exported
rg --color=never -n "prepareBundleForAiSummarization"

Length of output: 698


Import Path Verified

The prepareBundleForAiSummarization function is indeed exported from packages/core/src/command/ai-brief/filter.ts, and the import in packages/core/src/command/search-summary/create.ts correctly resolves via ../ai-brief/filter. No changes needed.

packages/shared/package.json (1)

3-3: Approve version bump to alpha pre-release
The version is correctly updated to 0.23.5-alpha.0, matching the coordinated alpha release across the monorepo.

packages/api/package.json (1)

3-3: Approve API package version bump
The API package version is correctly incremented to 1.27.5-alpha.0, aligning with the release plan for alpha pre-releases.

packages/ihe-gateway-sdk/package.json (3)

3-3: Approve SDK version bump
Version updated from 0.19.3 to 0.19.5-alpha.0, consistent with the pre-release cycle.


56-56: Approve shared dependency update
The @metriport/shared dependency is correctly advanced to ^0.23.5-alpha.0 to match the shared package’s new pre-release version.


3-56:

✅ Verification successful

Reminder: publish pre-release to NPM
As learned from prior SDK releases, ensure that 0.19.5-alpha.0 (and its updated dependencies) is published to the public registry before merging to avoid downstream build issues.

Run:


🏁 Script executed:

npm view @metriport/ihe-gateway-sdk versions

Length of output: 2744


🏁 Script executed:

npm view @metriport/shared versions

Length of output: 2555


Pre-release versions are already published

  • @metriport/ihe-gateway-sdk 0.19.5-alpha.0 is listed on npm
  • @metriport/shared 0.23.5-alpha.0 is listed on npm

No further action required before merging.

packages/carequality-cert-runner/package.json (3)

3-3: Approve version bump to alpha pre-release
The package version is correctly updated to 1.18.5-alpha.0, matching the coordinated pre-release flow.


44-44: Approve ihe-gateway-sdk dependency bump
Dependency on @metriport/ihe-gateway-sdk updated to ^0.19.5-alpha.0, aligning with the new SDK release.


45-45: Approve shared dependency bump
Dependency on @metriport/shared updated to ^0.23.5-alpha.0 to keep in sync with the shared package.

packages/mllp-server/package.json (1)

3-3: Approve version bump to alpha pre-release
The mllp-server version is correctly bumped to 0.3.5-alpha.0, consistent with the monorepo’s pre-release process.

packages/commonwell-sdk/package.json (1)

3-3: LGTM! Coordinated alpha version updates.

The version bumps are consistent with the alpha release process. Both the package version and the @metriport/shared dependency have been appropriately updated to alpha versions.

Also applies to: 63-63

packages/commonwell-cert-runner/package.json (1)

3-3: LGTM! Version updates align with ecosystem changes.

The alpha version bump and dependency update to @metriport/commonwell-sdk are consistent with the coordinated release process.

Also applies to: 45-45

packages/commonwell-jwt-maker/package.json (1)

3-3: LGTM! Consistent alpha versioning maintained.

The version increments and dependency updates follow the established pattern across the commonwell package ecosystem.

Also applies to: 44-44

docs/_snippets/consolidated-query.mdx (1)

7-9: LGTM! Documentation correctly reflects API changes.

The update from optional to required for the conversionType field aligns with the PR objective to make this parameter mandatory. The description and allowed values remain appropriately unchanged.

packages/core/src/external/aws/lambda-logic/bundle-to-html-derm.ts (1)

1322-1322: LGTM! HTML syntax error fixed.

The missing equals sign in the data-id attribute has been properly corrected, ensuring valid HTML syntax for the medication statement table row.

packages/api-sdk/src/medical/models/fhir.ts (1)

27-27: LGTM! Correct implementation of mandatory conversionType.

The schema change correctly enforces conversionType as a required field, removing the previous optional behavior. This aligns perfectly with the PR objective to make conversion type mandatory.

packages/api-sdk/package.json (2)

3-3: Correct major version bump for breaking changes.

The version increment from 14.14.3 to 15.0.0-alpha.0 appropriately reflects the breaking API changes where conversionType becomes mandatory.

Please ensure the alpha versions are published to NPM before merging this PR, as indicated in the previous learning from this codebase.


61-62: Dependency versions correctly updated to maintain consistency.

The alpha version updates for @metriport/commonwell-sdk and @metriport/shared maintain consistency across the monorepo dependencies.

packages/core/src/command/consolidated/get-snapshot.ts (1)

17-17: Correct type definition update for mandatory conversionType.

The change from optional to required conversionType in ConsolidatedSnapshotRequestAsync properly aligns with the schema changes in other files and enforces the new mandatory requirement.

packages/shared/src/interface/internal/consolidated.ts (1)

8-8: Schema correctly updated to enforce mandatory conversionType.

The change from optional to required conversionType in internalSendConsolidatedSchema is consistent with the corresponding changes in other schema files and properly enforces the new mandatory requirement.

packages/api/src/command/medical/patient/__tests__/consolidated-get.test.ts (1)

33-35: LGTM! Test updates align with mandatory conversionType requirement.

The test cases have been correctly updated to include the now-required conversionType: "json" parameter, ensuring compatibility with the updated function signature of getCurrentConsolidatedProgress.

Also applies to: 72-74

packages/core/src/command/consolidated/consolidated-get.ts (1)

124-124: LGTM! Correctly enforces conversionType as required parameter.

Making conversionType required ensures that all callers must explicitly specify the conversion type, preventing potential issues with undefined values and aligning with the broader API contract changes.

packages/core/src/external/aws/lambda-logic/bundle-to-html.ts (1)

1014-1014: LGTM! Fixes HTML attribute syntax error.

The missing = character in the data-id attribute has been correctly added, ensuring valid HTML syntax for medication statement rows.

packages/api/src/command/medical/patient/__tests__/store-query-cmd.ts (1)

38-38: LGTM! Test infrastructure properly supports mandatory conversionType.

The addition of conversionType: "json" to test data and the default value logic in the factory function ensure compatibility with the new required parameter while maintaining test functionality.

Also applies to: 61-61

packages/core/src/external/aws/lambda-logic/bundle-to-html-adhd.ts (1)

1242-1242: Correct HTML attribute syntax for data-id.

The data-id attribute on the <tr> element now includes the missing equals sign and proper quoting (data-id="${medicationStatement.id}"), fixing the malformed HTML that would have broken attribute parsing in the rendered output.

packages/api/src/routes/internal/medical/patient.ts (2)

669-670: Documentation accurately reflects the new requirement.

The updated documentation correctly specifies that conversionType is now required and includes the new "json" option alongside existing "pdf" and "html" values.


683-684: Properly enforces required conversionType parameter.

The change from optional() to orFail() correctly makes conversionType mandatory, and the toLowerCase() transformation ensures case-insensitive handling for better user experience. The schema validation will catch invalid values appropriately.

packages/api/src/command/medical/patient/consolidated-get.ts (2)

11-14: Import statement reordering is acceptable.

The reordering of import statements doesn't affect functionality and maintains readability.


262-262: Logic correctly simplified after making conversionType required.

Removing the truthiness check for conversionType is appropriate since it's now a required parameter and will never be undefined. The simplified condition conve 8000 rsionType != "json" && hasResources is cleaner and more direct.

packages/api/src/routes/medical/patient.ts (2)

276-278: Documentation improvement clarifies webhook behavior.

The updated documentation correctly specifies that conversionType is required and importantly clarifies that the webhook payload will always contain a signed URL valid for 3 minutes, regardless of conversion type. This removes ambiguity about the response format.


295-298: Consistent enforcement of required conversionType parameter.

The changes mirror the internal route implementation:

  • Using orFail() to enforce the required parameter
  • Direct parsing with consolidationConversionTypeSchema.parse()

This ensures consistent behavior across both internal and external API endpoints.

fern/definition/medical/fhir.yml (3)

12-26: Documentation formatting and content improvements.

The reformatted documentation improves readability and maintains accuracy about the endpoint's asynchronous behavior and webhook responses.


36-39: Correctly defines conversionType as required query parameter.

Moving conversionType from the request body to query parameters and making it required aligns with the implementation changes in the route handlers. The documentation clearly specifies the accepted values: "json", "html", or "pdf".


71-72: Example demonstrates new JSON conversion type.

The example appropriately showcases the new "json" conversion type, helping developers understand how to use the updated API.

packages/api-sdk/src/medical/client/metriport.ts (1)

498-498: LGTM: Default value provides backward compatibility.

The assignment of "json" as the default value is well-aligned with the broader changes to standardize the conversionType parameter while maintaining backward compatibility for existing SDK users.

@leite08
Copy link
Member
leite08 commented May 26, 2025

@coderabbitai review

Copy link
coderabbitai bot commented May 26, 2025
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Orta21 Orta21 added this pull request to the merge queue May 26, 2025
Merged via the queue into master with commit 5d76889 May 26, 2025
91 of 92 checks passed
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