Skip to content

Commit 6b4c03f

Browse files
authored
Albrja/mic-5776/remove-untracking-age (#520)
Albrja/mic-5776/remove-untracking-age Fixes configuration key to untracking age - *Category*: Bugfix - *JIRA issue*: https://jira.ihme.washington.edu/browse/MIC-5776 Changes and notes -Fixes configuration key to untracking age for FertilityCrudeBirthRate ### Testing <!-- Details on how code was verified, any unit tests local for the repo, regression testing, etc. At a minimum, this should include an integration test for a framework change. Consider: plots, images, (small) csv file. -->
1 parent f123d9f commit 6b4c03f

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
**4.0.2 - 05/01/25**
2+
3+
- Bugfix: Fix configuration key for untracking age in FertilityCrudeBirthRate
4+
15
**4.0.1 - 03/21/25**
26

37
- Feature: Update required resources for all components

src/vivarium_public_health/population/data_transformations.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,22 +561,24 @@ def get_live_births_per_year(builder):
561561

562562

563563
def rescale_final_age_bin(builder, population_data):
564-
exit_age = builder.configuration.population.to_dict().get("exit_age", None)
565-
if exit_age:
566-
population_data = population_data.loc[population_data["age_start"] < exit_age].copy()
567-
cut_bin_idx = exit_age <= population_data["age_end"]
564+
untracking_age = builder.configuration.population.to_dict().get("untracking_age", None)
565+
if untracking_age:
566+
population_data = population_data.loc[
567+
population_data["age_start"] < untracking_age
568+
].copy()
569+
cut_bin_idx = untracking_age <= population_data["age_end"]
568570
cut_age_start = population_data.loc[cut_bin_idx, "age_start"]
569571
cut_age_end = population_data.loc[cut_bin_idx, "age_end"]
570-
population_data.loc[cut_bin_idx, "value"] *= (exit_age - cut_age_start) / (
572+
population_data.loc[cut_bin_idx, "value"] *= (untracking_age - cut_age_start) / (
571573
cut_age_end - cut_age_start
572574
)
573-
population_data.loc[cut_bin_idx, "age_end"] = exit_age
575+
population_data.loc[cut_bin_idx, "age_end"] = untracking_age
574576
return population_data
575577

576578

577579
def validate_crude_birth_rate_data(builder, data_year_max):
578-
exit_age = builder.configuration.population.to_dict().get("exit_age", None)
579-
if exit_age and builder.configuration.population.age_end != exit_age:
580+
untracking_age = builder.configuration.population.to_dict().get("untracking_age", None)
581+
if untracking_age and builder.configuration.population.age_end != untracking_age:
580582
raise ValueError(
581583
"If you specify an exit age, the initial population age end must be the same "
582584
"for the crude birth rate calculation to work."

0 commit comments

Comments
 (0)