-
Notifications
You must be signed in to change notification settings - Fork 3
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
AG-1143/transform distribution data testing #82
Merged
jaclynbeck-sage
merged 6 commits into
dev
from
jbeck/AG-1143/transform_distribution_data_testing
Jul 13, 2023
Merged
AG-1143/transform distribution data testing #82
jaclynbeck-sage
merged 6 commits into
dev
from
jbeck/AG-1143/transform_distribution_data_testing
Jul 13, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…d updated tests to match
jaclynbeck-sage
commented
Jul 7, 2023
# Writing to JSON changes the "bins" entry in this dict from tuples to lists, so | ||
# output_dict and expected_dict would not be equal since expected_dict is read from JSON. | ||
# We solve this by turning output_dict into a JSON string and reading back into a dict. | ||
output_dict = json.loads(json.dumps(output_dict)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the best way to handle this problem but it's all I could come up with. Open to better suggestions.
…ounds the quartiles to 4 decimal places
…ve been moved to column_rename in the config file. Tests have been updated to match
JessterB
approved these changes
Jul 11, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great to me!
BWMac
approved these changes
Jul 11, 2023
jaclynbeck-sage
deleted the
jbeck/AG-1143/transform_distribution_data_testing
branch
July 13, 2023 18:51
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR addresses 2 JIRA tasks:
AG-1116: Removes the literature score from the
distribution_data
transform since it is no longer used.AG-1143: Adds data-driven tests for the
distribution_data
transform.I wrote the tests first, made sure they all passed, then removed the literature score from the transform and updated the tests accordingly. I've confirmed that the output of
transform_distribution_data
on the real data was identical to the previous output except for deletion of the literature score section in the JSON file, prior to bug fixes. After bug fixes (listed below), the output oftransform_distribution_data
is no longer identical to the previous output because dropping duplicate rows changes the distribution slightly, however the new output makes sense and looks correct when compared with the previous output.There are several "passing" test cases:
max_score
parameters as defined inconfig.yaml
max_score
parameters than defined inconfig.yaml
-- bins should widen and go up to the new max, but the distribution above the old max should all be 0's since there's no data in that range.target_risk_score
,genetics_score
,multi_omics_score
,literaturescore
(ignored),neuropathscore
(ignored),isscored_genetics
,isscored_omics
,isscored_lit
(ignored),isscored_neuropath
(ignored)The "good" input file has rows covering the following cases:
isscored
columns are "Y"isscored
columns are "N"isscored
valuesThere are 3 related "failure" cases:
target_risk_score
,genetics_score
, andmulti_omics_score
, one value is a string instead of a number. Throws aValueError
.NOTE: I did find some bugs in the transform while writing these tests. I have fixed the following bugs / clean up in this PR and adjusted the tests to match:
column_rename
in the config filepd.cut
is now called with the same arguments each time it is called (previously it was called a second time with a few args left off, but the intention seemed to be that it would produce the same bins as the first call).I confirmed that after bug fixes, all the distribution counts are equal or less than the previous output counts (as they should be if duplicate rows are now dropped), and that the new 4-decimal first/third quartile values could reasonably be rounded to the previous output integer values.