Fix ineffective .astype() calls in note_ratings.py #398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixed two instances where
.astype()calls had no effect because the return value was discarded.Problem
In
scoring/src/scoring/note_ratings.py, the following pattern appeared in two functions:Issue: In pandas,
.astype()returns a new Series with the converted dtype - it does not modify the original Series in place. Since the return value was not being assigned, this code was effectively a no-op.Affected functions:
get_note_counts_by_rater_sign()(line 393)get_population_sampled_counts_by_rater_sign()(line 525)Impact
This bug could cause type mismatch issues during subsequent merge operations if
raterParticipantIdKeycolumns have different dtypes between theraterModelOutputandratingsDataFrames. The intent of the original code was clearly to ensure type compatibility before merging.Fix
The fix:
.astype()back to the columnTesting
This is a straightforward bug fix that makes the existing code work as originally intended. The logic remains the same - only now the type conversion actually takes effect.