Skip to content

Commit e643e26

Browse files
committed
Use age group specific exposure for prevalence in paf calculations
1 parent 8686f0b commit e643e26

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/vivarium_gates_mncnh/components/lbwsg.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ class LBWSGPAFObserver(Component):
375375

376376
@property
377377
def columns_required(self) -> list[str] | None:
378-
return ["lbwsg_category", "gestational_age_exposure"]
378+
return ["lbwsg_category", "gestational_age_exposure", "age_bin"]
379379

380380
def __init__(self, target: str):
381381
super().__init__()
@@ -413,9 +413,12 @@ def calculate_paf(self, x: pd.DataFrame) -> float:
413413
relative_risk = self.risk_effect.adjust_target(x.index, pd.Series(1, index=x.index))
414414
relative_risk.name = "relative_risk"
415415
lbwsg_category = self.population_view.get(x.index)["lbwsg_category"]
416+
age_start = self.population_view.get(x.index).age_bin.iloc[0].left
416417
lbwsg_prevalence = self.lbwsg_exposure.rename(
417418
{"parameter": "lbwsg_category", "value": "prevalence"}, axis=1
418419
)
420+
# Subset to age group for exposure
421+
lbwsg_prevalence = lbwsg_prevalence.loc[lbwsg_prevalence["age_start"] == age_start]
419422
lbwsg_prevalence = lbwsg_prevalence.groupby("lbwsg_category", as_index=False)[
420423
"prevalence"
421424
].sum()

src/vivarium_gates_mncnh/data/lbwsg_paf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ components:
1313
configuration:
1414
input_data:
1515
input_draw_number: 0
16-
artifact_path: '/mnt/team/simulation_science/pub/models/vivarium_gates_mncnh/artifacts/cpap/nigeria.hdf'
16+
artifact_path: '/mnt/team/simulation_science/pub/models/vivarium_gates_mncnh/artifacts/paf/nigeria.hdf'
1717
interpolation:
1818
order: 0
1919
extrapolate: True

0 commit comments

Comments
 (0)