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

Modified the logic on computing validity vls #559

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

DennisGibz
Copy link
Contributor

@DennisGibz DennisGibz commented Feb 20, 2025

Summary by Sourcery

Modified the logic for computing the validity of viral load (VL) results. This includes adjusting the date range used for determining VL eligibility and incorporating the AgeLastVisit field to improve the accuracy of age calculations.

Bug Fixes:

  • Corrected the logic for computing valid viral load (VL) results by adjusting the date range for VL eligibility and incorporating the AgeLastVisit field to improve age calculation accuracy.

Enhancements:

  • Improved the viral load eligibility check by considering the AgeLastVisit field, providing a more accurate assessment of a patient's age at the time of the viral load test.

Copy link
Contributor

sourcery-ai bot commented Feb 20, 2025

Reviewer's Guide by Sourcery

This pull request modifies the logic for computing the validity of viral loads. The date range for data extraction has been adjusted, and the age calculation logic has been updated to prioritize the AgeLastVisit field. The IsValidVL logic has been updated to incorporate the AgeLastVisit field.

Updated class diagram for VLValidityCheckBasedOnEligibilityAndAge

classDiagram
    class VLValidityCheckBasedOnEligibilityAndAge {
        +SiteCode int
        +PatientPK int
        +VisitID varchar
        +MFLCode int
        +FacilityName varchar
        +Partner varchar
        +Agency varchar
        +PatientID varchar
        +PrepNumber varchar
        +StartARTDate date
        +CohortYearMonth int
        +CohortYear int
        +DOB date
        +AgeLastVisit int
        +AgeAsOfDate int
        +OrderedbyDate date
        +ReportedbyDate date
        +AsOfDate date
        +TestName varchar
        +TestResult varchar
        +Emr varchar
        +Project varchar
        +EligibleVL int
        +IsValidVL int
    }
    note for VLValidityCheckBasedOnEligibilityAndAge "The IsValidVL attribute is now calculated based on AgeLastVisit if available, otherwise using DOB."
Loading

File-Level Changes

Change Details Files
Adjusted the date range for data extraction by modifying the start and end dates.
  • Decreased the date range by one month.
Scripts/NDWH/C&T FACT TABLES/FactViralLoad_Hist.sql
Modified the logic for determining the age of a patient at the time of viral load order, prioritizing the AgeLastVisit field when available.
  • Introduced the AgeLastVisit field.
  • Used COALESCE to prioritize AgeLastVisit over the calculated age from DOB.
Scripts/NDWH/C&T FACT TABLES/FactViralLoad_Hist.sql
Updated the logic for determining IsValidVL based on AgeLastVisit.
  • Incorporated AgeLastVisit into the IsValidVL calculation.
  • Used COALESCE to handle cases where AgeLastVisit is null.
Scripts/NDWH/C&T FACT TABLES/FactViralLoad_Hist.sql

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @DennisGibz - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding comments to the queries to explain the logic behind key calculations, especially around age and date differences.
  • It might be helpful to add some logging or auditing to track the number of records processed and any potential errors encountered during the loop.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -2,11 +2,11 @@ TRUNCATE TABLE ndwh.Fact.FactViralLoad_Historical;

DECLARE @start_date DATE;

SELECT @start_date = dateadd(month, -24, eomonth(dateadd(month, -1, getdate())));
SELECT @start_date = dateadd(month, -24, eomonth(dateadd(month, -2, getdate())));
Copy link
Contributor

Choose a reason for hiding this comment

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

@DennisGibz this was for testing purposes perhaps ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thanks for noticing above. I have modified it from -2 to -1

@nobert-mumo
Copy link
Contributor

nobert-mumo commented Feb 23, 2025

@DennisGibz just general question, how does the ValidVL in the historical fact compare with FactViralLoad with the new changes?

@DennisGibz
Copy link
Contributor Author

@DennisGibz just general question, how does the ValidVL in the historical fact compare with FactViralLoad with the new changes?

@nobert-mumo the exaggerated numbers have drastically reduced but not tallied. Hist still has some higher numbers. 30K diff.

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