Skip to content

Commit 4b53cc9

Browse files
authored
Update malaria.py
Allow malaria to run without HIV (which also requires TB)
1 parent 7e6f9c8 commit 4b53cc9

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/tlo/methods/malaria.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,20 @@ def apply(self, population):
783783
df = population.props
784784
now = self.sim.date
785785

786-
# select currently pregnant women without IPTp, malaria-negative, not on cotrimoxazole
787-
p1 = df.index[df.is_alive & df.is_pregnant & ~df.ma_is_infected & ~df.ma_iptp & ~df.hv_on_cotrimoxazole]
786+
# select currently pregnant women without IPTp, malaria-negative, not on cotrimoxazole
787+
p1_condition = (
788+
df.is_alive
789+
& df.is_pregnant
790+
& ~df.ma_is_infected
791+
& ~df.ma_iptp
792+
& (
793+
~df.hv_on_cotrimoxazole
794+
if 'Hiv' in self.sim.modules
795+
else True
796+
)
797+
)
798+
799+
p1 = df.index[p1_condition]
788800

789801
for person_index in p1:
790802
logger.debug(key='message',
@@ -1191,7 +1203,7 @@ def apply(self, person_id, squeeze_factor):
11911203
return
11921204

11931205
# IPTp contra-indicated if currently on cotrimoxazole
1194-
if df.at[person_id, 'hv_on_cotrimoxazole']:
1206+
if 'Hiv' in self.sim.modules and df.at[person_id, "hv_on_cotrimoxazole"]:
11951207
return
11961208

11971209
logger.debug(key='message',

0 commit comments

Comments
 (0)