-
Notifications
You must be signed in to change notification settings - Fork 1
Edits to VPH Output package for Alzheimer's simulation #10
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
Open
NathanielBlairStahn
wants to merge
20
commits into
main
Choose a base branch
from
vph-outputs-improvements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+215
−23
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c6d5237
increment version to 0.5.0-dev
NathanielBlairStahn 6f1f093
add print_memory_usage and constant_categorical functions
NathanielBlairStahn 32e9842
use .reindex in difference function to preserve Categoricals in index
NathanielBlairStahn 58252d9
fix bug with unspecified dtype in constant_categorical
NathanielBlairStahn 98f6f81
use constant categoricals for numerator and denominator measures
NathanielBlairStahn 543ce19
allow passing the name of the column containing transition names in e…
NathanielBlairStahn a8aec29
add prefilter_query parameter to ratio function
NathanielBlairStahn 2da907b
allow passing a VPHOperator object to VPHResults constructor
NathanielBlairStahn c167d82
re-order parameters of ratio function
NathanielBlairStahn a8230ec
add convert_to_categorical function
NathanielBlairStahn a46d3be
add location_col parameter to VPHOperator
NathanielBlairStahn ba275ad
add location_col parameter to VPHResults
NathanielBlairStahn f040c20
reorder cases; add 'measure' parameter to ratio function
NathanielBlairStahn f9190d9
use numpy array instead of list in constant_categorical
NathanielBlairStahn e121e98
add lower and upper functions
NathanielBlairStahn 7c7d30d
write summarize_draws function as a generalized version of describe
NathanielBlairStahn 3518d1c
change cause column to 'entity' in get_burden
NathanielBlairStahn 04fbe48
group together functions dealing with categoricals
NathanielBlairStahn ae31502
fix typos in comments in averted function
NathanielBlairStahn 47f3fbb
check whether location column is in index before adding it
NathanielBlairStahn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,21 +10,24 @@ def __init__( | |
| self, | ||
| mapping=(), | ||
| /, | ||
| ops: VPHOperator|None = None, | ||
| value_col=None, | ||
| draw_col=None, | ||
| scenario_col=None, | ||
| measure_col=None, | ||
| location_col: str|bool=False, | ||
| index_cols=None, | ||
| # record_dalys=True, | ||
| **kwargs, | ||
| ): | ||
| super().__init__(mapping, **kwargs) | ||
| self.ops = VPHOperator( | ||
| self.ops = ops or VPHOperator( | ||
| value_col, | ||
| draw_col, | ||
| scenario_col, | ||
| measure_col, | ||
| index_cols | ||
| location_col, | ||
| index_cols, | ||
| ) | ||
| self._clean_vph_output() | ||
| # if record_dalys: | ||
|
|
@@ -104,12 +107,16 @@ def get_burden(self, measures=None): | |
| if 'dalys' in measures and 'dalys' not in table_names: | ||
| ylls = burden.query("measure == 'ylls'") | ||
| ylds = burden.query("measure == 'ylds'") | ||
| # FIXME: Define the cause column somewhere else that makes | ||
| # sense, and deal with different column names in older | ||
| # Vivarium models | ||
| cause_col = 'entity' # Used to be 'cause' | ||
|
Comment on lines
+110
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like at the least we could make this an argument to the function? |
||
| # If we have comorbidity-adjusted all-cause YLDs, ensure | ||
| # that we also have all-cause YLLs so all-cause DALYs will | ||
| # be correct | ||
| if 'all_causes' in np.setdiff1d(ylds['cause'], ylls['cause']): | ||
| if 'all_causes' in np.setdiff1d(ylds[cause_col], ylls[cause_col]): | ||
| all_cause_ylls = self.ops.marginalize( | ||
| ylls.assign(cause='all_causes'), []) | ||
| ylls.assign(**{cause_col: 'all_causes'}), []) | ||
| burden = pd.concat([burden, all_cause_ylls]) | ||
| # print('yll causes:', ylls.cause.unique()) | ||
| burden = self.ops.aggregate_categories( | ||
|
|
||
Oops, something went wrong.
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.
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.
We should get this set up with https://pypi.org/project/setuptools-scm/
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 bet this is done by #11 😄