Skip to content

Commit

Permalink
Merge pull request #186 from UCL/ds/ltpinfection
Browse files Browse the repository at this point in the history
 Long-term partner infection
  • Loading branch information
pineapple-cat authored Nov 14, 2024
2 parents 16f724e + 00f0400 commit 0319779
Show file tree
Hide file tree
Showing 8 changed files with 801 additions and 46 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ console_scripts =
run_model = hivpy.cli:run_model

[flake8]
max-line-length = 120
max-line-length = 150
per-file-ignores =
# Don't complain about unused imports in __init__.py
*/__init__.py: F401
Expand Down
2 changes: 1 addition & 1 deletion src/hivpy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import yaml

from .experiment import create_experiment, run_experiment
from hivpy.experiment import create_experiment, run_experiment


def run_model():
Expand Down
18 changes: 17 additions & 1 deletion src/hivpy/column_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
RISK_DIAGNOSIS = "risk_diagnosis" # float: risk associated with recent HIV diagnosis
RISK_PERSONAL = "risk_personal" # float: individual risk reduction applied with a certain probability
RISK_LTP = "risk_long_term_partnered" # float: risk reduction for people in long term partnerships
RISK_LTP_INFECTED = "risk_ltp_infected" # float: risk of infection from infected long term partner
RISK_ART_ADHERENCE = "risk_art_adherence" # float: risk reduction associated with low ART adherence
RISK_INITIAL = "risk_initial" # float: initial risk reduction factor
CIRCUMCISED = "circumcised" # bool: True if a man is circumcised
Expand All @@ -27,10 +28,18 @@
SEX_BEHAVIOUR = "sex_behaviour" # int: sexual behaviour grouping
SEX_BEHAVIOUR_CLASS = "sex_class" # sexual_behaviour.SexBehaviourClass(enum): Men, Young Women, Older Women, or Sex Workers
LONG_TERM_PARTNER = "long_term_partner" # bool: True if the subject has a long term condomless partner
LTP_NEW = "ltp_new" # bool: True if condomless sex with ltp is new this timestep
LTP_LONGEVITY = "ltp_longevity" # int: categorises longevity of long term partnerships (higher => more stable)
LTP_HIV_STATUS = "ltp_HIV_status" # bool: True if an individual's long term partner is infected with HIV (DUMMY)
LTP_HIV_DIAGNOSED = "ltp_HIV_diagnosed" # bool: True if an individual's long term partner is diagnosed with HIV (DUMMY)
LTP_ON_ART = "ltp_on_art" # bool: True if an individual's long term partner is on ART (DUMMY)
LTP_MONOGAMOUS = "ltp_monogamous" # bool: True if a person's long term partner has no short term partners o/w False
LTP_INFECTION_DATE = "ltp_infection_date" # date: date at which the long term partner gets infected o/w None if not infected
LTP_DIAGNOSED = "ltp_diagnosed" # bool: True if a person's long term partner has been diagnosed, o/w False
RECENT_LTP_DIAGNOSED = "recent_ltp_diagnosed" # bool: True if a person's most recent long term partner was diagnosed
RECENT_LTP_ART = "recent_ltp_art" # bool: True if a person's most recent long term partner was on ART
LTP_ART = "ltp_art" # bool: True if a person's long term partner is on ART
LTP_VIRAL_SUPPRESSED = "ltp_viral_suppressed" # bool: True if a person's long term partner is virally suppressed
LOW_FERTILITY = "low_fertility" # bool: True if a woman is considered to have a 0% chance of pregnancy, o/w False
PREGNANT = "pregnant" # bool: True if a woman is currently pregnant
LAST_PREGNANCY_DATE = "last_pregnancy_date" # None | datetime.date: date of most recent pregnancy, o/w None if never pregnant
Expand All @@ -41,6 +50,8 @@
NUM_HIV_CHILDREN = "num_HIV_children" # int: number of children infected with HIV a woman has
WANT_NO_CHILDREN = "want_no_children" # bool: True if a woman does not want any more children

ON_ART = "on_art" # bool: True if a person is currently on ART

SEX_WORKER = "sex_worker" # bool: True if person is a sex worker, o/w False
SW_AGE_GROUP = "sw_age_group" # int: categorises sex worker behaviour by age
DATE_STOP_SW = "date_stop_sex_work" # date: date at which a former sex worker (last) stopped sex work
Expand All @@ -62,14 +73,19 @@
NSTP_LAST_TEST = "nstp_last_test" # int: number of short term condomless sex partners since last test (DUMMY)
NP_LAST_TEST = "np_last_test" # int: total number of condomless sex partners since last test (DUMMY)
HIV_STATUS = "HIV_status" # bool: True if person is HIV positive, o/w False
LTP_STATUS = "LTP_status" # bool: True if long term partner is HIV positive, o/w False
RECENT_LTP_STATUS = "recent_LTP_status" # bool: True if the most recent long term partner was HIV positive
DATE_HIV_INFECTION = "date_HIV_infection" # None | date: date of HIV infection if HIV+, o/w None
IN_PRIMARY_INFECTION = "in_primary_infection" # bool: True if a person contracted HIV within 3 months of the current date, o/w False
HIV_INFECTION_GE6M = "HIV_infection_ge6m" # bool: True is a person has been infected with HIV for 6 months or more (DUMMY)
LTP_IN_PRIMARY = "ltp_in_primary" # bool: True if a person's long term partner is in primary infection
HIV_DIAGNOSED = "HIV_diagnosed" # bool: True if individual had a positive HIV test
HIV_DIAGNOSIS_DATE = "HIV_Diagnosis_Date" # None | datetime.date: date of HIV diagnosis (to nearest timestep) if HIV+, o/w None
VIRAL_LOAD_GROUP = "viral_load_group" # int: value 0-5 placing bounds on viral load for an HIV positive person. [(0, 2.7), (2.7, 3.7), (3.7, 4.7), (4.7, 5.7), > 5.7, primary infection]
UNDER_CARE = "under_care" # bool: True if under care after a positive HIV diagnosis
VIRAL_LOAD_GROUP = "viral_load_group" # int: value 0-5 placing bounds on viral load for an HIV positive person
VIRAL_LOAD = "viral_load" # float: viral load for HIV+ person
VIRAL_SUPPRESSION = "viral suppression" # bool: True if person is virally suppressed
RESISTANCE_MUTATIONS = "resistance_mutations" # integer: total proportion of (people in?) resistance mutations
CD4 = "cd4" # None | float: CD4 count per cubic millimeter; set to None for people w/o HIV
MAX_CD4 = "max_cd4" # float: maximum CD4 count to which a person can return when on ART
ART_NAIVE = "art_naive" # bool: True if person has never been on antiretroviral therapy
Expand Down
14 changes: 14 additions & 0 deletions src/hivpy/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ def opposite_sex(sex: SexType):
return (1 - sex)


def sub_pop_ratio(sp1, sp2):
if len(sp2) == 0:
return 0
else:
return len(sp1) / len(sp2)


def safe_ratio(n1, n2):
if n2 == 0:
return 0
else:
return n1/n2


class date:
def __init__(self, year, month=1, day=1):
self.year = year
Expand Down
Loading

0 comments on commit 0319779

Please sign in to comment.