EpiModelHIV ‐ code conventions - EpiModel/EpiModeling GitHub Wiki
Work In Progress
Module Structure
new_module <- function(dat, at) {
##Inputs
# Attributes
an.attribute <- get_attr(dat, "an.attribute")
# Parameters
a.param <- get_param(dat, "a.param")
## Process
an.attribute <- an.attribute + a.param
## Output
# Attributes
dat <- set_attr(dat, "an.attribute", an.attribute)
# Epi Trackers
dat <- set_epi(dat, "high.attributes", at, an.attribute > 10)
return(dat)
}
Naming
- parameters are
lower.dot.case - attributes are
lower.dot.case - variables in a module are
lower_snake_case - functions are
lower_snake_case
Name conventions
Try to follow the below example:
new disease xyz
-
xyz: 0-1; presence of the disease -
xyz.tx: 0-1; presence of treatment forxyz` -
xyz.dx: 0-1;xyz` diagnosed -
xyz.sympt: 0-1;xyz` with symptoms -
xyz.count: 0-Inf; number of time infected byxyz` -
xyz.tst.last: time step; last timexyzwas testd -
xyz.dx.last: time step; last timexyzwas diagnosed -
xyz.stage: 0-N; stage ofxyz -
xyz.prob: [0, 1]; probability of gettingxyz -
xyz.tx.int: 0-N; duration ofxyztreatment in timestep -
xyz.sympt.prob: [0, 1]; probability of havingxyzsymptoms