Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuous PrEP usage #208

Merged
merged 23 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
954f546
Refactored PrEP preference.
pineapple-cat Nov 1, 2024
863ab50
Refactored PrEP willingness.
pineapple-cat Nov 1, 2024
93f329d
Refactored PrEP preference rankings.
pineapple-cat Nov 1, 2024
20fe882
Added favoured PrEP column to simplify starting PrEP.
pineapple-cat Nov 1, 2024
acbec0a
Unified PrEP preference, willingness, ranks, and favoured PrEP under …
pineapple-cat Nov 1, 2024
48f4724
Updated PrEP tests to account for changed propensity and favoured PrEP.
pineapple-cat Nov 1, 2024
e5e966a
Re-added accidentally deleted PrEP eligibility.
pineapple-cat Nov 1, 2024
0fbf6f5
Minor fixes and updates, including new apply function for population …
pineapple-cat Nov 4, 2024
0d70a2a
Undummied PrEP just started flags.
pineapple-cat Nov 4, 2024
e10cd75
Added PrEP stop probabilities.
pineapple-cat Nov 4, 2024
edb7c57
Added PrEP continuation columns.
pineapple-cat Nov 4, 2024
596d3d6
Updated base PrEP start probability distribution to match SAS core.
pineapple-cat Nov 5, 2024
007190e
Removed some redundant sub-pop filtering for starting PrEP - HIV stat…
pineapple-cat Nov 5, 2024
b83fec5
Added continuing and switching PrEP.
pineapple-cat Nov 5, 2024
5de9875
Fixed failing simulation tests.
pineapple-cat Nov 6, 2024
06999d4
Added PrEP stop date and updated starting and continuing PrEP date ou…
pineapple-cat Nov 6, 2024
d0451a3
Updated starting PrEP test to check continuous and cumulative usage.
pineapple-cat Nov 6, 2024
a92c098
Added continuous and cumulative use to starting PrEP after testing.
pineapple-cat Nov 6, 2024
d894d3e
Added basic continuing PrEP unit test.
pineapple-cat Nov 6, 2024
a4dcf3e
Added restarting PrEP.
pineapple-cat Nov 7, 2024
09f8538
Minor refactor to setting PrEP start date and cumulative use columns.
pineapple-cat Nov 8, 2024
f461a44
Updated eligibility criteria correctness for starting and restarting …
pineapple-cat Nov 11, 2024
78a7c74
Added Cab availability flag.
pineapple-cat Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/hivpy/column_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,29 @@
PREP_LEN_WILLING = "prep_len_willing" # Bool: True if an individual is willing to use injectable Lenacapavir PrEP
PREP_VR_WILLING = "prep_vr_willing" # Bool: True if an individual is willing to use vaginal ring PrEP
PREP_ANY_WILLING = "prep_any_willing" # Bool: True if an individual is willing to use at least one type of PrEP
FAVOURED_PREP_TYPE = "favoured_prep_type" # None | prep.PrEPType(enum): PrEP type with highest preference an individual is willing to take that is also currently available, o/w None
PREP_ELIGIBLE = "prep_eligible" # Bool: True if an individual is eligible for PrEP usage
PREP_ORAL_TESTED = "prep_oral_tested" # Bool: True if an individual has tested explicitly to start oral PrEP (DUMMY)
PREP_CAB_TESTED = "prep_cab_tested" # Bool: True if an individual has tested explicitly to start injectable Cab PrEP (DUMMY)
PREP_LEN_TESTED = "prep_len_tested" # Bool: True if an individual has tested explicitly to start injectable Len PrEP (DUMMY)
PREP_VR_TESTED = "prep_vr_tested" # Bool: True if an individual has tested explicitly to start vaginal ring PrEP (DUMMY)
PREP_TYPE = "prep_type" # None | prep.PrEPType(enum): Oral, Cabotegravir, Lenacapavir, or VaginalRing if PrEP is being used, o/w None
EVER_PREP = "ever_prep" # Bool: True if an individual has ever been on PrEP
FIRST_ORAL_START_DATE = "first_oral_start_date" # None | date: start date of first ever oral PrEP usage
FIRST_CAB_START_DATE = "first_cab_start_date" # None | date: start date of first ever injectable Cab PrEP usage
FIRST_LEN_START_DATE = "first_len_start_date" # None | date: start date of first ever injectable Len PrEP usage
FIRST_VR_START_DATE = "first_vr_start_date" # None | date: start date of first ever vaginal ring PrEP usage
LAST_PREP_START_DATE = "last_prep_start_date" # None | date: start date of most recent PrEP usage
PREP_JUST_STARTED = "prep_just_started" # Bool: True if PrEP usage began this time step (DUMMY)
PREP_ORAL_TESTED = "prep_oral_tested" # Bool: True if an individual has tested explicitly to start oral PrEP (DUMMY)
PREP_CAB_TESTED = "prep_cab_tested" # Bool: True if an individual has tested explicitly to start injectable Cab PrEP (DUMMY)
PREP_LEN_TESTED = "prep_len_tested" # Bool: True if an individual has tested explicitly to start injectable Len PrEP (DUMMY)
PREP_VR_TESTED = "prep_vr_tested" # Bool: True if an individual has tested explicitly to start vaginal ring PrEP (DUMMY)

ART_ADHERENCE = "art_adherence" # DUMMY
LAST_PREP_STOP_DATE = "last_prep_stop_date" # None | date: stop date of most recent PrEP usage
PREP_JUST_STARTED = "prep_just_started" # Bool: True if PrEP usage began this time step
CONT_ON_PREP = "cont_on_prep" # None | timedelta: total length of continuous usage of current PrEP based on user intention (breaks due to ineligibility do not count against continuity)
CONT_ACTIVE_ON_PREP = "cont_active_on_prep" # None | timedelta: actual total length of continuous usage of current PrEP
CUMULATIVE_PREP_ORAL = "cumulative_prep_oral" # None | timedelta: total length of cumulative oral PrEP usage
CUMULATIVE_PREP_CAB = "cumulative_prep_cab" # None | timedelta: total length of cumulative injectable Cab PrEP usage
CUMULATIVE_PREP_LEN = "cumulative_prep_len" # None | timedelta: total length of cumulative injectable Len PrEP usage
CUMULATIVE_PREP_VR = "cumulative_prep_vr" # None | timedelta: total length of cumulative injectable vaginal ring PrEP usage

ART_ADHERENCE = "art_adherence" # None | Float: percentage of ART intake that is adhered to
TA_MUTATION = "tam" # X_MUTATION: drug resistance cols (TODO: all 24 currently DUMMIED)
M184_MUTATION = "m184m"
K65_MUTATION = "k65m"
Expand Down
8 changes: 6 additions & 2 deletions src/hivpy/data/prep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ prep_willing_threshold: 0.2
prob_test_prep_start:
Value: [0.25, 0.50, 0.75]
prob_base_prep_start:
Value: [0.05, 0.10, 0.20]
# FIXME: do we need this to be separate from prob_base_prep_start?
Value: [0.10, 0.30]
prob_prep_restart:
Value: [0.05, 0.10, 0.20]
prob_base_prep_stop:
Value: [0.05, 0.15, 0.30]
prob_base_prep_stop_nonuniform:
Value: [0.05, 0.15, 0.30]
Probability: [0.8, 0.1, 0.1]
15 changes: 13 additions & 2 deletions src/hivpy/population.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,17 @@ def general_func(g):
# Use Dummy column to in order to enable transform method and avoid any risks to data
return df.groupby(param_list, dropna=dropna)["Dummy"].transform(general_func)

def col_apply(self, param_list, func, sub_pop=None):
"""
Applies a function to specific columns in the dataframe.
"""
if sub_pop is not None:
df = self.data.loc[sub_pop]
else:
df = self.data
# Lambda function used to extract param column contents
return df.apply(lambda x: func(*[x[p] for p in param_list]), axis=1)

def evolve(self, time_step: timedelta):
"""
Advance the population by one time step.
Expand All @@ -287,7 +298,7 @@ def evolve(self, time_step: timedelta):
if self.HIV_introduced:
self.hiv_status.set_primary_infection(self)
self.hiv_status.set_viral_load_groups(self)
self.prep.prep_willingness(self)
self.prep.prep_propensity(self)
self.prep.prep_eligibility(self)

if self.circumcision.vmmc_disrup_covid:
Expand All @@ -306,7 +317,7 @@ def evolve(self, time_step: timedelta):
if (n_deaths and self.apply_death):
self.drop_from_population(HIV_deaths)
self.hiv_diagnosis.update_HIV_diagnosis(self)
self.prep.prep_usage(self)
self.prep.prep_usage(self, time_step)

# Some population cleanup
self.pregnancy.reset_anc_at_birth(self)
Expand Down
Loading
Loading