Skip to content

Commit

Permalink
updated-stratification-structure
Browse files Browse the repository at this point in the history
  • Loading branch information
alrah007 committed Oct 11, 2024
1 parent c0fbc44 commit d0826f8
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 82 deletions.
14 changes: 7 additions & 7 deletions titan/features/partner_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ def update_agent(self, model: "model.TITAN"):

# Starting Jan 2021, use improved PS parameters
if model.time >= 48:
params.participate_prob[self.agent.race] = params.participate_prob_improved[self.agent.race]
params[self.agent.race].participate_prob = params[self.agent.race].participate_prob_improved
params.tracing_prob = params.tracing_prob_improved
params.contact_prob[self.agent.race] = params.contact_prob_improved[self.agent.race]
params.partner_participate_prob[self.agent.race] = params.partner_participate_prob_improved[self.agent.race]
params[self.agent.race].contact_prob = params[self.agent.race].contact_prob_improved
params[self.agent.race].partner_participate_prob = params[self.agent.race].partner_participate_prob_improved
params.treatment_prob = params.treatment_prob_improved
params.prep_prob[self.agent.race] = params.prep_prob_improved[self.agent.race]
params[self.agent.race].prep_prob = params[self.agent.race].prep_prob_improved
params.re_haart_prob = params.re_haart_prob_improved

if model.time < params.start_time or model.time > params.stop_time:
Expand All @@ -85,7 +85,7 @@ def update_agent(self, model: "model.TITAN"):
and agent_exposure.dx_time == model.time - 1
):
# step 1
self.participate = True if model.run_random.random() < params.participate_prob[self.agent.race] else False
self.participate = True if model.run_random.random() < params[self.agent.race].participate_prob else False

if self.participate:
self.participate_time = model.time
Expand All @@ -97,7 +97,7 @@ def update_agent(self, model: "model.TITAN"):
if (
self.active
and self.time < model.time
and model.run_random.random() < params.partner_participate_prob[self.agent.race]
and model.run_random.random() < params[self.agent.race].partner_participate_prob
):
# mark agents who participate
self.ps_participant = True
Expand Down Expand Up @@ -159,7 +159,7 @@ def trace_partners(self, params, model: "model.TITAN"):
# step 3
self.info = True if model.run_random.random() < params.tracing_prob else False # can only trace if participant provides information
# step 4
self.contact = True if model.run_random.random() < params.contact_prob[ptnr.race] else False # contact stochastically
self.contact = True if model.run_random.random() < params[ptnr.race].contact_prob else False # contact stochastically

if self.info:
self.info_stat += 1
Expand Down
6 changes: 3 additions & 3 deletions titan/features/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ def initiate(self, model: "model.TITAN", force: bool = False):

# else if agent tested negative through PS, use appropriate probability
elif "Racial" in params.prep.target_model and self.agent.partner_tracing.tested_negative:
prep_prob = self.agent.location.params.partner_tracing.prep_prob[self.agent.race]
prep_prob = self.agent.location.params.partner_tracing[self.agent.race].prep_prob
if model.run_random.random() <= prep_prob:
self.enroll(model.run_random, model.time)
self.ps_prep = True
self.ps_add_stat()

else:
if self.agent.partner_tracing.tested_negative:
prep_prob = self.agent.location.params.partner_tracing.prep_prob[self.agent.race]
prep_prob = self.agent.location.params.partner_tracing[self.agent.race].prep_prob
if model.run_random.random() <= prep_prob:
self.enroll(model.run_random, model.time)
self.ps_prep = True
Expand Down Expand Up @@ -232,7 +232,7 @@ def initiate(self, model: "model.TITAN", force: bool = False):

# tested through PS
elif self.agent.partner_tracing.tested_negative:
target_prep = self.agent.partner_tracing.get_negative_count() * self.agent.location.params.partner_tracing.prep_prob[self.agent.race]
target_prep = self.agent.partner_tracing.get_negative_count() * self.agent.location.params.partner_tracing[self.agent.race].prep_prob

if self.ps_get_stat() < target_prep:
self.enroll(model.run_random, model.time)
Expand Down
228 changes: 156 additions & 72 deletions titan/params/partner_tracing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,108 +37,192 @@ partner_tracing:
description: "For how many time steps after partner diagnosis a partner is traced"
type: int
default: 1
participate_prob:
description: Probability that a given agent is willing to participate in the partner services program
type: float
default:
white: 0.630
black: 0.561
latino: 0.580
min: 0
max: 1

white:
participate_prob:
description: Probability that a given agent is willing to participate in the partner services program
type: float
default: 0.630
min: 0
max: 1
contact_prob:
description: Probability that a named partner will be contacted
type: float
default: 0.7
min: 0
max: 1
partner_participate_prob:
description: Probability that a contacted partner will participate in the PS and get tested
type: float
default: 0.56
min: 0
max: 1
prep_prob:
description: Probability that a partner who tested negative for HIV through PS will be referred to prep
type: float
default: 0.49
min: 0
max: 1
participate_prob_improved:
description: Probability that a given agent is willing to participate in the partner services program
type: float
default: 0.630
min: 0
max: 1
contact_prob_improved:
description: Probability that a named partner will be contacted
type: float
default: 0.7
min: 0
max: 1
partner_participate_prob_improved:
description: Probability that a contacted partner will participate in the PS and get tested
type: float
default: 0.56
min: 0
max: 1
prep_prob_improved:
description: Probability that a partner who tested negative for HIV through PS will be referred to prep
type: float
default: 0.49
min: 0
max: 1

black:
participate_prob:
description: Probability that a given agent is willing to participate in the partner services program
type: float
default: 0.561
min: 0
max: 1
contact_prob:
description: Probability that a named partner will be contacted
type: float
default: 0.69
min: 0
max: 1
partner_participate_prob:
description: Probability that a contacted partner will participate in the PS and get tested
type: float
default: 0.49
min: 0
max: 1
prep_prob:
description: Probability that a partner who tested negative for HIV through PS will be referred to prep
type: float
default: 0.5
min: 0
max: 1
participate_prob_improved:
description: Probability that a given agent is willing to participate in the partner services program
type: float
default: 0.561
min: 0
max: 1
contact_prob_improved:
description: Probability that a named partner will be contacted
type: float
default: 0.69
min: 0
max: 1
partner_participate_prob_improved:
description: Probability that a contacted partner will participate in the PS and get tested
type: float
default: 0.49
min: 0
max: 1
prep_prob_improved:
description: Probability that a partner who tested negative for HIV through PS will be referred to prep
type: float
default: 0.5
min: 0
max: 1

latino:
participate_prob:
description: Probability that a given agent is willing to participate in the partner services program
type: float
default: 0.580
min: 0
max: 1
contact_prob:
description: Probability that a named partner will be contacted
type: float
default: 0.75
min: 0
max: 1
partner_participate_prob:
description: Probability that a contacted partner will participate in the PS and get tested
type: float
default: 0.54
min: 0
max: 1
prep_prob:
description: Probability that a partner who tested negative for HIV through PS will be referred to prep
type: float
default: 0.4
min: 0
max: 1
participate_prob_improved:
description: Probability that a given agent is willing to participate in the partner services program
type: float
default: 0.580
min: 0
max: 1
contact_prob_improved:
description: Probability that a named partner will be contacted
type: float
default: 0.75
min: 0
max: 1
partner_participate_prob_improved:
description: Probability that a contacted partner will participate in the PS and get tested
type: float
default: 0.54
min: 0
max: 1
prep_prob_improved:
description: Probability that a partner who tested negative for HIV through PS will be referred to prep
type: float
default: 0.4
min: 0
max: 1

tracing_prob:
description: Probability of tracing a partner based on the amount of information provided by agent
type: float
default: 0.66 # calibrated
min: 0
max: 1
contact_prob:
description: Probability that a named partner will be contacted
type: float
default:
white: 0.7
black: 0.69
latino: 0.75
min: 0
max: 1
partner_participate_prob:
description: Probability that a contacted partner will participate in the PS and get tested
type: float
default:
white: 0.56
black: 0.49
latino: 0.54
min: 0
max: 1

treatment_prob:
description: Probability that a partner who has been diagnosed through PS will receive treatment
type: float
default: 0.82
min: 0
max: 1
prep_prob:
description: Probability that a partner who tested negative for HIV through PS will be referred to prep
type: float
default:
white: 0.49
black: 0.5
latino: 0.4
min: 0
max: 1

re_haart_prob:
description: Probability that a traced agent who has been previously diagnosed and not on haart reengages/engages haart
type: float
default: 0.549
min: 0
max: 1
participate_prob_improved:
description: Probability that a given agent is willing to participate in the partner services program
type: float
default:
white: 0.961
black: 0.855
latino: 0.884
min: 0
max: 1

tracing_prob_improved:
description: Probability of tracing a partner based on the amount of information provided by agent
type: float
default: 0.9 # calibrated
min: 0
max: 1
contact_prob_improved:
description: Probability that a named partner will be contacted
type: float
default:
white: 0.883
black: 0.871
latino: 0.946
min: 0
max: 1
partner_participate_prob_improved:
description: Probability that a contacted partner will participate in the PS and get tested
type: float
default:
white: 0.951
black: 0.832
latino: 0.917
min: 0
max: 1

treatment_prob_improved:
description: Probability that a partner who has been diagnosed through PS will receive treatment
type: float
default: 0.9
min: 0
max: 1
prep_prob_improved:
description: Probability that a partner who tested negative for HIV through PS will be referred to prep
type: float
default:
white: 0.942
black: 0.972
latino: 0.786
min: 0
max: 1

re_haart_prob_improved:
description: Probability that a traced agent who has been previously diagnosed and not on haart reengages/engages haart
type: float
Expand Down

0 comments on commit d0826f8

Please sign in to comment.