Skip to content

Commit

Permalink
add check confirming whether we want to validate for one year
Browse files Browse the repository at this point in the history
  • Loading branch information
hussain-jafari committed Feb 20, 2024
1 parent 25c7a0d commit 719d0c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/vivarium_inputs/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ def get_measure(
"""
data = core.get_data(entity, measure, location, get_all_years)
data = utilities.scrub_gbd_conventions(data, location)
validation.validate_for_simulation(data, entity, measure, location)
context_args = {}
if not get_all_years:
most_recent_year = utility_data.get_most_recent_year()
context_args["years"] = pd.DataFrame(
{"year_start": most_recent_year, "year_end": most_recent_year + 1}, index=[0]
)
validation.validate_for_simulation(data, entity, measure, location, **context_args)
data = utilities.split_interval(data, interval_column="age", split_column_prefix="age")
data = utilities.split_interval(data, interval_column="year", split_column_prefix="year")
return utilities.sort_hierarchical_data(data)
Expand Down
4 changes: 0 additions & 4 deletions src/vivarium_inputs/validation/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ def validate_for_simulation(
if measure not in validators:
raise NotImplementedError()

most_recent_year = utility_data.get_most_recent_year()
context_args["years"] = pd.DataFrame(
{"year_start": most_recent_year, "year_end": most_recent_year + 1}, index=[0]
)
context = SimulationValidationContext(location, **context_args)
validators[measure](data, entity, context)

Expand Down

0 comments on commit 719d0c3

Please sign in to comment.