Skip to content
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

LNK-2801 Add Property to Kafka Messages #419

Conversation

edward-miller-lcg
Copy link
Contributor

@edward-miller-lcg edward-miller-lcg commented Aug 5, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new property, AcquisitionComplete, to improve tracking of resource acquisition completion across multiple classes.
    • Enhanced the Get method to include better error handling and logging for successful and failed data retrieval processes.
    • Improved message processing to handle completed acquisitions differently, enabling logging and further processing of messages even when resources are missing.
  • Bug Fixes

    • Refined error handling in message processing logic to enhance validation based on the AcquisitionComplete status.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Walkthrough

The changes introduce a new boolean property, AcquisitionComplete, across several classes involved in resource acquisition and normalization. This property enhances the ability to track whether the acquisition process has been completed. Additionally, the PatientDataService class has been improved with better error handling and logging, which facilitates improved operational workflows and provides better insights into acquisition statuses.

Changes

Files Change Summary
DotNet/DataAcquisition/Application/Models/Kafka/ResourceAcquired.cs Added public bool AcquisitionComplete { get; set; } = false; to ResourceAcquired.
DotNet/Normalization/Application/Models/Messages/ResourceAcquiredMessage.cs Added public bool AcquisitionComplete { get; set; } = false; to ResourceAcquiredMessage.
DotNet/Normalization/Application/Models/Messages/ResourceNormalizedMessage.cs Added public bool AcquisitionComplete { get; set; } = false; to ResourceNormalizedMessage.
DotNet/DataAcquisition/Application/Services/PatientDataService.cs Enhanced Get method with improved error handling and added ProduceTailingMessage for logging acquisition status.
DotNet/Normalization/Listeners/ResourceAcquiredListener.cs Updated StartConsumerLoop to include checks for AcquisitionComplete, refining error handling.

Assessment against linked issues

Objective Addressed Explanation
Add AcquisitionComplete property to event models (LNK-2801)
Update normalization logic to accommodate new property (LNK-2801)
Enhance error handling in PatientDataService to log context (LNK-2801)
Ensure ResourceNormalizedMessage reflects AcquisitionComplete status (LNK-2801)

Possibly related issues

  • LNK-2802: The new property may enhance logging and monitoring capabilities related to resource acquisition.
  • LNK-2803: Modifications to acquisition completion tracking could impact workflows that rely on the status of resource acquisitions.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e96a0c1 and 91ca511.

Files selected for processing (5)
  • DotNet/DataAcquisition/Application/Models/Kafka/ResourceAcquired.cs (1 hunks)
  • DotNet/DataAcquisition/Application/Services/PatientDataService.cs (1 hunks)
  • DotNet/Normalization/Application/Models/Messages/ResourceAcquiredMessage.cs (1 hunks)
  • DotNet/Normalization/Application/Models/Messages/ResourceNormalizedMessage.cs (1 hunks)
  • DotNet/Normalization/Listeners/ResourceAcquiredListener.cs (3 hunks)
Additional comments not posted (9)
DotNet/Normalization/Application/Models/Messages/ResourceAcquiredMessage.cs (1)

7-7: Addition of new property AcquisitionComplete looks good.

The new property AcquisitionComplete is a boolean initialized to false. This enhances the class by allowing it to track the completion status of resource acquisition.

DotNet/DataAcquisition/Application/Models/Kafka/ResourceAcquired.cs (1)

7-7: Addition of new property AcquisitionComplete looks good.

The new property AcquisitionComplete is a boolean initialized to false. This enhances the class by allowing it to track the completion status of resource acquisition.

DotNet/Normalization/Application/Models/Messages/ResourceNormalizedMessage.cs (1)

8-8: Addition of new property AcquisitionComplete looks good.

The new property AcquisitionComplete is a boolean initialized to false. This enhances the class by allowing it to track the completion status of resource acquisition.

DotNet/DataAcquisition/Application/Services/PatientDataService.cs (3)

202-204: Ensure proper error handling in the Get method.

The addition of the ProduceTailingMessage call within the catch block is a good practice to log the context of the failure. Ensure that all relevant identifiers are correctly passed to the method.


213-214: Ensure the completion status is correctly logged.

The addition of the ProduceTailingMessage call after the try-catch block ensures that the completion status is logged regardless of the outcome. This enhances the traceability of the data acquisition process.


217-235: Verify the correctness of the ProduceTailingMessage method.

The method correctly constructs and sends a ResourceAcquired message to the Kafka topic. Ensure that all necessary properties are included and correctly assigned.

DotNet/Normalization/Listeners/ResourceAcquiredListener.cs (3)

107-113: Enhance error handling conditions in StartConsumerLoop.

The new condition ensures that a DeadLetterException is only thrown if AcquisitionComplete is false. This allows for more nuanced control over message validity.


128-150: Handle completed acquisitions with null resources.

The new logic handles scenarios where AcquisitionComplete is true but the resource is null, allowing for the production of messages for further processing. This enhances the robustness of the message processing logic.


310-313: Ensure correct assignment of new properties in ResourceNormalizedMessage.

The new properties are correctly assigned based on the updated message structure. This ensures consistency in the way the message data is handled throughout the method.

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 91ca511 and f5b26e4.

Files selected for processing (1)
  • DotNet/Normalization/Listeners/ResourceAcquiredListener.cs (3 hunks)
Additional comments not posted (4)
DotNet/Normalization/Listeners/ResourceAcquiredListener.cs (4)

107-113: Verify the correctness of the new condition.

The new condition refines error handling by allowing messages with AcquisitionComplete set to true to bypass certain checks. Ensure that this change aligns with the intended logic and does not introduce any unintended side effects.


146-167: Verify the accuracy of logging and message construction.

The new logic allows for the production of messages even when resources are missing. Ensure that the informational log and the construction of ResourceNormalizedMessage are accurate and align with the intended functionality.


169-171: LGTM!

The code correctly checks if the operation sequence is null or empty and handles it appropriately.


310-313: LGTM!

The code correctly updates the construction of ResourceNormalizedMessage to include the AcquisitionComplete property.

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f5b26e4 and aff2514.

Files selected for processing (1)
  • DotNet/Normalization/Listeners/ResourceAcquiredListener.cs (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • DotNet/Normalization/Listeners/ResourceAcquiredListener.cs

Copy link
Contributor

@arianamihailescu arianamihailescu left a comment

Choose a reason for hiding this comment

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

Looks good

…dicate-if-the-resource-acquisition-process-has-completed-in-Data-Acquisition-and-Normalization
@edward-miller-lcg edward-miller-lcg merged commit b524787 into dev Aug 5, 2024
16 checks passed
@seanmcilvenna seanmcilvenna deleted the LNK-2801-Add-a-property-to-event-models-to-indicate-if-the-resource-acquisition-process-has-completed-in-Data-Acquisition-and-Normalization branch August 6, 2024 23:55
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