Skip to content

Testing - tern fix for analysis function refactor bugs #189

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 4 commits into from
Mar 11, 2025

Conversation

edelarua
Copy link
Contributor

@edelarua edelarua commented Mar 6, 2025

@edelarua edelarua added the sme label Mar 6, 2025
Copy link
Contributor

github-actions bot commented Mar 6, 2025

Unit Tests Summary

  1 files  111 suites   3m 28s ⏱️
245 tests 245 ✅ 0 💤 0 ❌
522 runs  522 ✅ 0 💤 0 ❌

Results for commit 9ba1743.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Mar 6, 2025

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
pagination_table 💔 $12.21$ $+1.99$ $+9$ $-6$ $0$ $0$
table_aet03 💔 $1.58$ $+3.33$ $+4$ $-1$ $0$ $0$
table_aet04 💔 $6.41$ $+5.83$ $+14$ $-8$ $0$ $0$
table_ent 💚 $13.98$ $-1.07$ $0$ $-4$ $0$ $0$
table_pkct01 💔 $1.55$ $+1.76$ $+6$ $-2$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
pagination_table 💔 $1.55$ $+2.11$ Pagination_works_for_page_types
table_aet03 💔 $1.58$ $+3.33$ AET03_variant_1_is_produced_correctly
table_pkct01 💔 $1.20$ $+1.55$ Specific_PKCT01_features_are_present

Results for commit ddac8b7

♻️ This comment has been updated with latest results.

@edelarua
Copy link
Contributor Author

edelarua commented Mar 6, 2025

The snapshot update is not related to tern - it comes from the data.

I'm not sure when the data was changed, but the change to the LBT03 snapshot reflects the expected result as all CHG values are NA when AVISIT == "Baseline", so this change should be merged in.

pharmaverseadam::adlb |> 
  dplyr::filter(AVISIT == "Baseline") |> 
  dplyr::pull(CHG) |> 
  unique()
#> [1] NA

Created on 2025-03-06 with reprex v2.1.1

@shajoezhu
Copy link
Contributor

The snapshot update is not related to tern - it comes from the data.

I'm not sure when the data was changed, but the change to the LBT03 snapshot reflects the expected result as all CHG values are NA when AVISIT == "Baseline", so this change should be merged in.

pharmaverseadam::adlb |> 
  dplyr::filter(AVISIT == "Baseline") |> 
  dplyr::pull(CHG) |> 
  unique()
#> [1] NA

Created on 2025-03-06 with reprex v2.1.1

this is really odd. lets follow up, @edelarua , I was wondeing when updating the snapshot, are you updating it locally on your machine?

@edelarua
Copy link
Contributor Author

edelarua commented Mar 7, 2025

The snapshot update is not related to tern - it comes from the data.
I'm not sure when the data was changed, but the change to the LBT03 snapshot reflects the expected result as all CHG values are NA when AVISIT == "Baseline", so this change should be merged in.

pharmaverseadam::adlb |> 
  dplyr::filter(AVISIT == "Baseline") |> 
  dplyr::pull(CHG) |> 
  unique()
#> [1] NA

Created on 2025-03-06 with reprex v2.1.1

this is really odd. lets follow up, @edelarua , I was wondeing when updating the snapshot, are you updating it locally on your machine?

Yes, it happens locally and in the integration tests. The updated results make sense since the change from baseline values at the baseline visit should be 0/NA, not what we had previously.

@shajoezhu
Copy link
Contributor

The snapshot update is not related to tern - it comes from the data.
I'm not sure when the data was changed, but the change to the LBT03 snapshot reflects the expected result as all CHG values are NA when AVISIT == "Baseline", so this change should be merged in.

pharmaverseadam::adlb |> 
  dplyr::filter(AVISIT == "Baseline") |> 
  dplyr::pull(CHG) |> 
  unique()
#> [1] NA

Created on 2025-03-06 with reprex v2.1.1

this is really odd. lets follow up, @edelarua , I was wondeing when updating the snapshot, are you updating it locally on your machine?

Yes, it happens locally and in the integration tests. The updated results make sense since the change from baseline values at the baseline visit should be 0/NA, not what we had previously.

I would like to check the computation in tern again, perhaps we caught a bug that was not found before. The data change happened for some time already, but we have been refactoring the computation.

@edelarua
Copy link
Contributor Author

Hi @shajoezhu & @Melkiades,

I have pinpointed where exactly the change is coming from: https://github.com/insightsengineering/tern/pull/1401/files#diff-19af54bdeb1d75fc74da8834bca1f4d2c90d1d33c3650aa93bab0fae8505a7ceR201

The inclNA argument of summarize_change() was previously set (incorrectly) to na_rm and I changed it to !na_rm since including NAs is the same as not removing NAs. This was originally added in this PR - I remember catching this when reviewing the analyze_vars() function as well.

This is why the snapshot changed here and then back to the original result in this PR.

I think in light of this we can merge insightsengineering/tern#1406 and then this change in.

@shajoezhu
Copy link
Contributor

Thank you so much @edelarua ! this is good!

Signed-off-by: Joe Zhu <sha.joe.zhu@gmail.com>
@shajoezhu shajoezhu enabled auto-merge (squash) March 11, 2025 03:24
Copy link
Contributor

@shajoezhu shajoezhu left a comment

Choose a reason for hiding this comment

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

lgtm! thanks @edelarua

@shajoezhu shajoezhu disabled auto-merge March 11, 2025 03:49
@shajoezhu shajoezhu enabled auto-merge (squash) March 11, 2025 03:49
@shajoezhu shajoezhu merged commit 329832a into main Mar 11, 2025
29 checks passed
@shajoezhu shajoezhu deleted the 1405_afun_refactor_bugs branch March 11, 2025 03:49
@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants