Conversation
…tation for preterm csmr
| @property | ||
| def sub_components(self) -> List[str]: | ||
| return [self.lbwsg] | ||
| def columns_created(self) -> list[str]: |
There was a problem hiding this comment.
Changes in this file are for the refactor to the pregnancy component since the NewChildren component was more a class that stroed methods and it is now a proper subcomponent.
| self.population_view.update(pop) | ||
|
|
||
|
|
||
| class ChildrenBirthExposure(Component): |
There was a problem hiding this comment.
This component also just moves where the gestational age and birthweight columns are being created.
| GESTATIONAL_AGE = "gestational_age" | ||
|
|
||
|
|
||
| class LBWSGDistribution(LBWSGDistribution_): |
There was a problem hiding this comment.
These components are so we use the correct columns to do lookup for birth exposure.
| excluded_stratifications=self.config.exclude, | ||
| when="time_step__prepare", | ||
| ) | ||
| # Add observer to get paf for preterm birth population |
There was a problem hiding this comment.
Adds an additional observer for a special preterm "PAF"
| # Register csmr pipeline | ||
| self.csmr = builder.value.register_value_producer( | ||
| f"cause.{self.neonatal_cause}.cause_specific_mortality_rate", | ||
| f"{self.neonatal_cause}.cause_specific_mortality_rate", |
There was a problem hiding this comment.
THis is why relative risks were not being applied to the CSMR pipeline.
| pop = self.population_view.get(index) | ||
| ga_greater_than_37 = pop[COLUMNS.GESTATIONAL_AGE] >= 37 | ||
|
|
||
| normalized_csmr = super().get_normalized_csmr(index) |
| if self._sim_step_name() == SIMULATION_EVENT_NAMES.EARLY_NEONATAL_MORTALITY: | ||
| pop.loc[alive_children.index, COLUMNS.CHILD_AGE] = (7 / 2) / 365.0 | ||
| else: | ||
| pop.loc[alive_children.index, COLUMNS.CHILD_AGE] = ((28 - 7) / 2) / 365.0 |
There was a problem hiding this comment.
Slightly more pythonic:
| if self._sim_step_name() == SIMULATION_EVENT_NAMES.EARLY_NEONATAL_MORTALITY: | |
| pop.loc[alive_children.index, COLUMNS.CHILD_AGE] = (7 / 2) / 365.0 | |
| else: | |
| pop.loc[alive_children.index, COLUMNS.CHILD_AGE] = ((28 - 7) / 2) / 365.0 | |
| age_group_midpoints = { | |
| SIMULATION_EVENT_NAMES.EARLY_NEONATAL_MORTALITY: (7 / 2) / 365.0, | |
| SIMULATION_EVENT_NAMES.LATE_NEONATAL_MORTALITY: (7 + (28 - 7) / 2) / 365.0, | |
| } | |
| pop.loc[alive_children.index, COLUMNS.CHILD_AGE] = age_group_midpoints[self._sim_step_name()] |
| return [self.gestational_age, self.birth_weight] | ||
|
|
||
| def setup(self, builder: Builder) -> None: | ||
| # todo get the lbwsg value pipelines |
| @property | ||
| def columns_created(self) -> list[str]: | ||
| return [ | ||
| COLUMNS.GESTATIONAL_AGE, |
There was a problem hiding this comment.
Do we still have multiple columns for gestational age and birth weight?
There was a problem hiding this comment.
Yes. One is the birth exposure columns that come from the pipeline and then these that are just gestational age and birth weight. I'm not sure why the NO project initialized these columns separately but I assume it is so we can put some effect on simulants and see if that changes these values from the pipelien.
Bugfix/LBWSGRiskEffect Fixes issues when subclassing LBWSG - *Category*: Bugfix - *JIRA issue*: https://jira.ihme.washington.edu/browse/MIC-5894 - *Research reference*: <!--Link to research documentation for code --> Changes and notes -refactors preganncy -fixes bug when subclassing LBWSG -fixes pipeline names ### Verification and Testing <!-- Details on how code was verified. Consider: plots, images, (small) csv files. -->
Bugfix/LBWSGRiskEffect
Fixes issues when subclassing LBWSG
Changes and notes
-refactors preganncy
-fixes bug when subclassing LBWSG
-fixes pipeline names
Verification and Testing