From 3f829e6e5a8a7e88db956321160ca324fd8dff62 Mon Sep 17 00:00:00 2001 From: Steve Bachmeier Date: Thu, 4 Aug 2022 15:10:55 -0700 Subject: [PATCH 1/6] register collect_metrics listener on 'collect_metrics' (not 'time_step') --- src/vivarium_public_health/metrics/disease.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vivarium_public_health/metrics/disease.py b/src/vivarium_public_health/metrics/disease.py index df1e7da8d..46764d9cc 100644 --- a/src/vivarium_public_health/metrics/disease.py +++ b/src/vivarium_public_health/metrics/disease.py @@ -138,7 +138,7 @@ def _register_time_step_prepare_listener(self, builder: Builder) -> None: builder.event.register_listener("time_step__prepare", self.on_time_step_prepare) def _register_collect_metrics_listener(self, builder: Builder) -> None: - builder.event.register_listener("time_step", self.on_collect_metrics) + builder.event.register_listener("collect_metrics", self.on_collect_metrics) def _register_metrics_modifier(self, builder: Builder) -> None: builder.value.register_value_modifier( @@ -181,7 +181,9 @@ def on_collect_metrics(self, event: Event) -> None: pop = self.population_view.get( event.index, query='tracked == True and alive == "alive"' ) + # SDB - Here, pop.ischemic_stroke != pop.previous_ischemic_stroke returns all False? This means no counts are updated. groups = self.stratifier.group(pop.index, self.config.include, self.config.exclude) + breakpoint() for label, group_mask in groups: for transition in self.transitions: transition_mask = ( @@ -193,6 +195,9 @@ def on_collect_metrics(self, event: Event) -> None: f"{self.disease}_{transition}_event_count_{label}": transition_mask.sum() } self.counts.update(new_observations) + print(transition_mask.sum()) + breakpoint() + print('') ################################## # Pipeline sources and modifiers # From db9294bd89d2fcf6728254e85ef143f0da8db9f6 Mon Sep 17 00:00:00 2001 From: Steve Bachmeier Date: Thu, 4 Aug 2022 15:22:42 -0700 Subject: [PATCH 2/6] oops - remove breakpoints --- src/vivarium_public_health/metrics/disease.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/vivarium_public_health/metrics/disease.py b/src/vivarium_public_health/metrics/disease.py index 46764d9cc..1fd4895d6 100644 --- a/src/vivarium_public_health/metrics/disease.py +++ b/src/vivarium_public_health/metrics/disease.py @@ -183,7 +183,6 @@ def on_collect_metrics(self, event: Event) -> None: ) # SDB - Here, pop.ischemic_stroke != pop.previous_ischemic_stroke returns all False? This means no counts are updated. groups = self.stratifier.group(pop.index, self.config.include, self.config.exclude) - breakpoint() for label, group_mask in groups: for transition in self.transitions: transition_mask = ( @@ -196,8 +195,6 @@ def on_collect_metrics(self, event: Event) -> None: } self.counts.update(new_observations) print(transition_mask.sum()) - breakpoint() - print('') ################################## # Pipeline sources and modifiers # From 5efcf7c35325c6094df4fb6aeb97efded942711a Mon Sep 17 00:00:00 2001 From: Steve Bachmeier Date: Thu, 4 Aug 2022 15:24:12 -0700 Subject: [PATCH 3/6] oops - remove diagnostic things --- src/vivarium_public_health/metrics/disease.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/vivarium_public_health/metrics/disease.py b/src/vivarium_public_health/metrics/disease.py index 1fd4895d6..b79881011 100644 --- a/src/vivarium_public_health/metrics/disease.py +++ b/src/vivarium_public_health/metrics/disease.py @@ -181,7 +181,6 @@ def on_collect_metrics(self, event: Event) -> None: pop = self.population_view.get( event.index, query='tracked == True and alive == "alive"' ) - # SDB - Here, pop.ischemic_stroke != pop.previous_ischemic_stroke returns all False? This means no counts are updated. groups = self.stratifier.group(pop.index, self.config.include, self.config.exclude) for label, group_mask in groups: for transition in self.transitions: @@ -194,7 +193,6 @@ def on_collect_metrics(self, event: Event) -> None: f"{self.disease}_{transition}_event_count_{label}": transition_mask.sum() } self.counts.update(new_observations) - print(transition_mask.sum()) ################################## # Pipeline sources and modifiers # From 77faeb5331e53f97e63bf4ea4f4ffe95a10d5d25 Mon Sep 17 00:00:00 2001 From: albrja <37345113+albrja@users.noreply.github.com> Date: Tue, 6 Sep 2022 10:21:35 -0700 Subject: [PATCH 4/6] Feature/rr logging (#292) Add logging for relative risk data less than 1. Added a check to log a message to the user if there are rows of relative risk data with values less than 1 for a given risk effect. - *Category*: Documentation/Other - *JIRA issue*: [MIC-2102](https://jira.ihme.washington.edu/browse/MIC-2102) -Added a check to see if any values for relative risk are below 1. -If there are any values, a message is logged to the user. Testing Tested values both above and below expected boundary (1.0) and saw log message accordingly. --- src/vivarium_public_health/risks/data_transformations.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vivarium_public_health/risks/data_transformations.py b/src/vivarium_public_health/risks/data_transformations.py index 22e6a33a6..c4ac57bc6 100644 --- a/src/vivarium_public_health/risks/data_transformations.py +++ b/src/vivarium_public_health/risks/data_transformations.py @@ -7,10 +7,12 @@ risk data and performing any necessary data transformations. """ + from typing import Union import numpy as np import pandas as pd +from loguru import logger from vivarium_public_health.utilities import EntityString, TargetString @@ -181,6 +183,12 @@ def get_relative_risk_data(builder, risk: EntityString, target: TargetString): "unordered_polytomous", ]: relative_risk_data = pivot_categorical(relative_risk_data) + # Check if any values for relative risk are below expected boundary of 1.0 + category_columns = [c for c in relative_risk_data.columns if "cat" in c] + if not relative_risk_data[(relative_risk_data[category_columns] < 1.0).any(axis=1)].empty: + logger.warning( + f"WARNING: Some data values are below the expected boundary of 1.0 for {risk}.relative_risk" + ) else: relative_risk_data = relative_risk_data.drop(columns=["parameter"]) From 1cafa3e22361a94638856fbb26de1bd237ce09d6 Mon Sep 17 00:00:00 2001 From: Rajan Mudambi <11376379+rmudambi@users.noreply.github.com> Date: Wed, 16 Nov 2022 16:51:44 -0800 Subject: [PATCH 5/6] update pr template and codeowners --- .github/CODEOWNERS | 2 +- .github/pull_request_template.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 412504b5d..a8b512b56 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,2 @@ # default owners -* @albrja @beatrixkh @collijk @hussain-jafari @mattkappel @rmudambi @stevebachmeier +* @albrja @beatrixkh @collijk @hussain-jafari @mattkappel @ramittal @rmudambi @stevebachmeier diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f52218b55..c20c3c331 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,8 +5,9 @@ - *Category*: -- *JIRA issue*: +- *JIRA issue*: [MIC-XYZ](https://jira.ihme.washington.edu/browse/MIC-XYZ) +### Changes and notes