8000 ENG-191 Always send analytics on getConsolidated by leite08 · Pull Request #3813 · metriport/metriport · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ENG-191 Always send analytics on getConsolidated #3813

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 1 commit into from
May 10, 2025

Conversation

leite08
Copy link
Member
@leite08 leite08 commented May 10, 2025

Dependencies

Description

Fix a regression, analytics not being sent after upstream was merged - context.

Also update the logic that runs on the lambda so it uses analyticsAsync to make sure those are sent before the lambda shuts down - context.

Testing

  • Local - branch-to-staging
    • Consolidated gets generated, with and w/o conversion
    • Analytics are sent to Posthog
  • Staging
    • Run consolidated, check analytics are populated
  • Sandbox
    • none
  • Production
    • Analytics are being populated again

Release Plan

  • Merge this

Summary by CodeRabbit

  • New Features
    • Enhanced analytics tracking for consolidated patient queries, including detailed event reporting with timing and resource counts.
  • Refactor
    • Improved parameter handling and optional analytics triggering for consolidated snapshot requests.
  • Style
    • Minor formatting updates for readability.

Copy link
linear bot commented May 10, 2025

Copy link
coderabbitai bot commented May 10, 2025

Walkthrough

This change adds analytics tracking to the consolidated query process for patient medical data. It introduces an optional sendAnalytics flag in consolidated snapshot request types, conditionally sends asynchronous analytics events in the snapshot connector, and enhances the getConsolidated function to log detailed analytics including elapsed time and resource counts.

Changes

File(s) Change Summary
packages/api/src/command/medical/patient/consolidated-get.ts Added analytics tracking in getConsolidated function, including elapsed time calculation and event sending at multiple points during data processing.
packages/api/src/command/medical/patient/consolidated-recreate.ts Added sendAnalytics: true to the payload sent to the consolidated snapshot connector when conversionType is not provided.
packages/core/src/command/consolidated/get-snapshot-lambda.ts Added a blank line after the lambdaClient property; no functional or logic changes.
packages/core/src/command/consolidated/get-snapshot-local.ts Changed analytics reporting to be asynchronous and conditional on a new sendAnalytics flag; updated imports and method signature accordingly.
packages/core/src/command/consolidated/get-snapshot.ts Updated type definitions to add optional sendAnalytics property for synchronous requests, disallowed for asynchronous requests.

Sequence Diagram(s)

sequenceDiagram
    participant API as API Layer
    participant Connector as ConsolidatedSnapshotConnector
    participant Analytics as Analytics Service

    API->>Connector: execute({sendAnalytics: true/false, ...})
    alt sendAnalytics is true
        Connector->>Analytics: analyticsAsync(event details)
        Analytics-->>Connector: (ack)
    end
    Connector-->>API: consolidated snapshot result
Loading

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 75d154d and c923bb0.

📒 Files selected for processing (5)
  • packages/api/src/command/medical/patient/consolidated-get.ts (4 hunks)
  • packages/api/src/command/medical/patient/consolidated-recreate.ts (1 hunks)
  • packages/core/src/command/consolidated/get-snapshot-lambda.ts (1 hunks)
  • packages/core/src/command/consolidated/get-snapshot-local.ts (3 hunks)
  • packages/core/src/command/consolidated/get-snapshot.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/core/src/command/consolidated/get-snapshot-lambda.ts
  • packages/api/src/command/medical/patient/consolidated-recreate.ts
  • packages/core/src/command/consolidated/get-snapshot.ts
  • packages/core/src/command/consolidated/get-snapshot-local.ts
  • packages/api/src/command/medical/patient/consolidated-get.ts

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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 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.

@leite08 leite08 marked this pull request as ready for review May 10, 2025 03:22
Ref eng-191

Signed-off-by: Rafael Leite <2132564+leite08@users.noreply.github.com>
@leite08 leite08 added this pull request to the merge queue May 10, 2025
Merged via the queue into develop with commit 5d76c97 May 10, 2025
24 checks passed
@leite08 leite08 deleted the eng-191-fix-analytrics branch May 10, 2025 17:09
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