Skip to content

Conversation

@adamrefaey
Copy link
Collaborator

@adamrefaey adamrefaey commented Apr 25, 2025

Change

This pull request introduces significant enhancements to the medical document processing pipeline by incorporating verification against trusted medical sources and improving error handling. Key changes include adding a verification step using Perplexity AI, updating the analysis logic to handle missing reference ranges, and expanding the Perplexity service with a new method for reviewing medical analyses.

Enhancements to Medical Document Analysis:

  • Updated aws-bedrock.service.ts to include a list of trusted medical sources (e.g., Mayo Clinic, CDC, WHO) for analysis and to handle cases where reference ranges are missing by using standard ranges from these sources. ([[1]](https://github.com/ModusCreateOrg/app-med-ai-gen/pull/110/files#diff-5c85186b48ca73f6f71ee9bca3b21941f8a85b0f18c47f20c0bb94dfddcbb0adR59-R70), [[2]](https://github.com/ModusCreateOrg/app-med-ai-gen/pull/110/files#diff-5c85186b48ca73f6f71ee9bca3b21941f8a85b0f18c47f20c0bb94dfddcbb0adR103))

Integration of Perplexity AI for Verification:

  • Modified document-processor.service.ts to introduce a new step where Perplexity AI reviews and verifies the medical analysis. If the review fails, the system falls back to the initial analysis. ([backend/src/document-processor/services/document-processor.service.tsL58-R82](https://github.com/ModusCreateOrg/app-med-ai-gen/pull/110/files#diff-5e997b182ce449d133c60c45abf8b6a3951b5730d733d3cc56869f4d5624df89L58-R82))
  • Added a new reviewMedicalAnalysis method in perplexity.service.ts to validate medical document analyses against trusted sources, ensuring accuracy in lab values, interpretations, and recommendations. ([backend/src/services/perplexity.service.tsR165-R229](https://github.com/ModusCreateOrg/app-med-ai-gen/pull/110/files#diff-43cc86a138bda7d361d75e44ee9b0ff5c3128c44e30d9f7bc4cbc01a8ac6b45dR165-R229))

Improvements to Perplexity API Interaction:

  • Simplified the createChatCompletion method's description in perplexity.service.ts to clarify its purpose. ([backend/src/services/perplexity.service.tsL99-R99](https://github.com/ModusCreateOrg/app-med-ai-gen/pull/110/files#diff-43cc86a138bda7d361d75e44ee9b0ff5c3128c44e30d9f7bc4cbc01a8ac6b45dL99-R99))

Does this PR introduce a breaking change?

{...}

What needs to be documented once your changes are merged?

{...}

Additional Comments

{...}

… for analysis and improving error handling in the review process. Update Perplexity service to include a new method for verifying medical document analyses against authoritative sources. Ensure all user-facing text is internationalized.
@adamrefaey adamrefaey requested review from GuidoBR and Copilot April 25, 2025 14:36
@adamrefaey adamrefaey self-assigned this Apr 25, 2025

This comment was marked as outdated.

…eateChatCompletion for clarity and consistency. Update method calls accordingly. Ensure all user-facing text is internationalized.
@adamrefaey adamrefaey changed the title [ADE-66] Enhance medical document processing by adding trusted medical sourcesfor analysis and improving error handling in the review process. Update Perplexity service to include a new method for verifying medical document analyses against authoritative sources. Ensure all user-facing text is internationalized. [ADE-66] Enhance medical document processing by adding trusted medical sources for analysis and other improvements Apr 25, 2025
@adamrefaey adamrefaey requested a review from Copilot April 25, 2025 14:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the medical document processing pipeline by integrating trusted medical sources verification and improving error handling with Perplexity AI.

  • Incorporates a review step using Perplexity AI in the document processing flow.
  • Updates AWS Bedrock analysis instructions to include a comprehensive list of trusted medical sources and handle missing reference ranges.
  • Introduces a new reviewMedicalAnalysis method in the Perplexity service for verifying and correcting medical analyses.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
backend/src/services/perplexity.service.ts Added reviewMedicalAnalysis method and updated createChatCompletion documentation.
backend/src/document-processor/services/document-processor.service.ts Integrated Perplexity review step with error fallback.
backend/src/document-processor/services/aws-bedrock.service.ts Updated extraction instructions to incorporate additional trusted medical sources and reference range handling.

@GuidoBR GuidoBR merged commit 5d4f922 into main Apr 25, 2025
1 check 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.

3 participants