Skip to content

Documentation

yuval-b edited this page Jul 2, 2026 · 8 revisions

Welcome to the idem_mech_hack wiki!

2026-06-04

  • opened repo
  • added team
  • added r proj
  • added wiki
  • such success
  • initial scripts for population

Next week:

  • resolve branch / merge conflicts that prevent upload of qmd scripts
  • make function work sensible and begin simulation adventures.

meeting notes from Tash (special guest appearance as documenter)

GR created a repo (idem_mech_hack) John and Yuval added to the IDEM Git
All IDEM added to repo
Created a wiki for documentation
Associate R project to the repo
August writing random assignment code for driver/documentor roster Nick writing wiki page with objectives
Rest of IDEM and group can edit
Helpful code tldr touch and it will give a bunch of examples
Put list in wiki (done) Plan of action: Focusing on simulation aspect first
Simulate for individuals e.g. transmission
Coding to finish 5mins before end of meeting slot Final 5mins for planning next sessions activities
Every instance of AI use to be recorded in Github issue (whether it work/how well it worked etc)

2026-06-18

Chitra driving screenshare, August documentation

  • resolved pull/push/merge issue with rebase = TRUE
  • review the infection function
  • renamed function argument index to individual_index for clarification
  • no second-generation infection within one discrete time-step (assuming that the time-step is small enough that discrete implementation is approximating the continuous process sufficiently)
  • write a for loop to iterate the infection function over individuals
  • added previous_infection state in a for-loop to iterate over all individuals such that the state doesn't get updated per individual, only per time-step
  • tested the for-loop with arbitrarily higher infection prob to test behaviour - it works as intended
  • build a population state matrix of individual by time-step
  • iterate over time and individual in the double for-loop

Nick's suggestion

for (t in 1:n_times) {
  previous_population_states <- population_states
  for(i in individual_index) {
    population_states[i] <- infection_function(i, 0.6, 2, previous_population_states)
  }
}
  • side discussion about pre-initialising contact pattern at each time-step, as opposed to taking random draws of contact inside the function. Aim to implement this as an individual by individual contact matrix
  • informally tested the loop implementation and found it sensible
  • task for future: how to check if the simulation outcomes are physically consistent with the dynamical system
  • begin to build formal tests

Sara's suggestion

test_that("Infection function returns TRUE for infected individual", {
  index <- 1
  p_infection <- 0.1
  n_contacts <- 2
  population_states <- c(TRUE, rep(FALSE, 9))
  test_infected <- infection_function(
    index,
    p_infection,
    n_contacts,
    population_states
  )
  expect_true(test_infected)
})

round of applause for Chitra's expert driving skills!

2026-07-02

Driver: Kate Documenter: Yuval

  • Made variables not be hard coded in the function line (line 77, infection_variables)
  • Renamed population_states -> infection_status, and population_over_time -> infection_status_over_time (closing issue #2)
  • Want to resolve the contacts being asymmetric at the moment - discussed different options for creating contact networks and how to use them
  • Currently creating a list of contacts and second contacts based on desired number of total connections (edges) and discard any self-loops (i.e. contacts contacting themselves) - so currently maximum number of total edges (connections) in the whole network is <= n_contact_events. We use a logical vector (keep) to do this.
  • Note that currently we are assuming there can be multiple contacts at the same timestep between two individuals (e.g. i can meet j twice, which would impact the probability of transmission between them). We want to adjust this later.
  • Working on updating the infection_function to read the individual's contacts during the timestep and use this to update the infection status, but first we list each individual's contacts using a for loop over each individual_indices. Then we list the infectious_contacts of the individual's total contacts

Assumptions made / things to fix:

  • Multiple contacts by the same two people per day are excluded currently, but note this means that we have an upper bound of n_contact_events and it is likely to be lower - we may want to fix this so that we get exactly n_contact_events per timesetep
  • Potentially introduce a different kind of contact network
  • Recreate the contact pairs at every timestep

Next time: first thing is to check that infection_function() works as intended.

Well done Kate!!

Clone this wiki locally