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

new location object in json files and load in model #56

Closed
wants to merge 77 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
2ef8434
Bump cookiecutter from 1.7.0 to 2.1.1
dependabot[bot] Jun 10, 2022
732f629
Add contributors to the code
nunezco2 Jun 10, 2022
5615257
Merge pull request #17 from ncsa/16-improve-readmemd
nunezco2 Jun 10, 2022
da93e9f
Merge pull request #15 from ncsa/dependabot/pip/cookiecutter-2.1.1
nunezco2 Jun 10, 2022
67f969f
Update requirements_conda.txt
nunezco2 Jun 10, 2022
41d9e33
Update requirements.txt
nunezco2 Jun 10, 2022
02d083d
Update requirements.txt
nunezco2 Jun 10, 2022
b2ebfaa
Update ci.yaml
nunezco2 Jun 10, 2022
ed90d63
Update requirements.txt
nunezco2 Jun 10, 2022
a3a4586
Update requirements.txt
nunezco2 Jun 10, 2022
e216cd9
Update requirements.txt
nunezco2 Jun 10, 2022
0075d5a
add data class
Jun 20, 2022
9523c3f
Merge pull request #22 from ncsa/21-add-data-class-new
nunezco2 Jun 21, 2022
24509ac
model runner
Jun 24, 2022
cc6b501
Merge pull request #24 from ncsa/23-model-runner-new
nunezco2 Jun 24, 2022
1b333ac
Adding root scripts
xinyih8 Jun 27, 2022
8d028b0
Merge branch 'master' of https://github.com/snunezcr/COVID19-mesa
xinyih8 Jun 27, 2022
e3cc754
correct if statement
xinyih8 Jun 27, 2022
aace7fb
correct if statment in test2 and delete previous push
xinyih8 Jun 28, 2022
083332b
Rdaraframe
xinyih8 Jun 29, 2022
f585eaf
correct
xinyih8 Jun 29, 2022
3dbc779
Find object in gROOT
nunezco2 Jun 29, 2022
96a9f15
Add new scripts
nunezco2 Jun 29, 2022
98b0504
Bump up numpy
nunezco2 Jun 29, 2022
ece753e
Numpy vulnerabilities patched
nunezco2 Jun 29, 2022
c0b2655
Loosen click dependencies
nunezco2 Jun 29, 2022
b4062e9
Relax matplotlib requirements
nunezco2 Jun 29, 2022
32265a5
Relax networkx requirements
nunezco2 Jun 29, 2022
eed0634
average
xinyih8 Jun 30, 2022
2750284
Merge branch 'master' of https://github.com/snunezcr/COVID19-mesa
xinyih8 Jun 30, 2022
e3a9eca
Debugged required value access to RResultPtr
nunezco2 Jun 30, 2022
1b7771d
Merge branch 'master' of https://github.com/ncsa/COVID19-mesa
nunezco2 Jun 30, 2022
5e36cdb
test
xinyih8 Jul 1, 2022
cf12d88
test compile
xinyih8 Jul 2, 2022
f313aff
Merge branch 'master' of https://github.com/ncsa/COVID19-mesa
nunezco2 Jul 5, 2022
6202dda
test
xinyih8 Jul 5, 2022
15b3249
Merge branch 'master' of https://github.com/snunezcr/COVID19-mesa
xinyih8 Jul 5, 2022
f53f166
test
xinyih8 Jul 5, 2022
78db12f
add dataclass to covidmodel
Jul 6, 2022
8a51353
Merge pull request #29 from ncsa/28-dataclass-covidmodel
boda26 Jul 7, 2022
5ec80a9
test
xinyih8 Jul 7, 2022
39d2d9e
step:sus
xinyih8 Jul 8, 2022
d55040f
Merge branch 'master' of https://github.com/snunezcr/COVID19-mesa
xinyih8 Jul 8, 2022
0ab9f28
test
xinyih8 Jul 8, 2022
2074432
Histo2D
xinyih8 Jul 8, 2022
a0307fe
url
xinyih8 Jul 9, 2022
edc2b6a
csv hesder
xinyih8 Jul 9, 2022
fcdafa3
average
xinyih8 Jul 9, 2022
6a5bc1c
2D
xinyih8 Jul 9, 2022
b6f8c2b
1
xinyih8 Jul 9, 2022
f22691d
average
xinyih8 Jul 9, 2022
cc21a55
Graph
xinyih8 Jul 10, 2022
2ddcf56
MakeTree, Average and CI
xinyih8 Jul 11, 2022
6087118
Tree builder and graph maker
xinyih8 Jul 11, 2022
322f837
Apply to other csv file
xinyih8 Jul 12, 2022
d0a9dda
Simplify MakeTree()
xinyih8 Jul 12, 2022
4e9d82c
Add database connection
Jul 12, 2022
0d9e6bb
moving averge
xinyih8 Jul 13, 2022
2714113
generalize k and ci
xinyih8 Jul 14, 2022
8e6ccf1
add database functions
Jul 15, 2022
f904ac9
modify K
xinyih8 Jul 18, 2022
883f3e2
final code
xinyih8 Jul 18, 2022
98cbe08
commit
Jul 19, 2022
599ac56
Merge pull request #31 from ncsa/30-database-new
boda26 Jul 19, 2022
4a115ae
Create specific visualization
nunezco2 Jul 20, 2022
a25bb92
Merge branch 'master' of https://github.com/ncsa/COVID19-mesa
nunezco2 Jul 20, 2022
d384d47
Update README.md
boda26 Jul 21, 2022
096e292
perf: Use Python builtin RNG to generate Bernoulli samples
rht Jul 24, 2022
5ef523e
Merge pull request #36 from rht/perf
nunezco2 Jul 25, 2022
87dc07b
perf: Use Python builtin random.random to generate Poisson samples
rht Jul 26, 2022
5a89831
Merge pull request #37 from rht/perf
snunezcr Jul 28, 2022
cecf430
perf: Access grid content of single position directly
rht Jul 28, 2022
9703ec1
Merge pull request #38 from rht/perf
snunezcr Jul 29, 2022
5e7bf5e
Add policy handler (#51)
xinyih8 Feb 13, 2023
c5cbce0
dwell time for locations (#50)
boda26 Feb 20, 2023
547656a
new location object in json files and load in model
Feb 25, 2023
22bfb07
add space
boda26 Feb 27, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
test:
strategy:
matrix:
python-version: [3.7]
python-version: [3.9]
runs-on: ubuntu-latest

steps:
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# COVID19-mesa


## Authors

*Santiago Nunez-Corrales, Informatics and NCSA, UIUC ([email protected])*

*Eric Jakobsson, Molecular and Cell Biology and NCSA, UIUC ([email protected])*

## Developers

* Angelo Santos
* Boda Song
* Xinyi Huang


A simple simulation to explore contagion by COVID-19 via agent-based modeling (ABM), as well as potential effectiveness of various measures.

**This software is under development rapidly to attempt to respond to the current situation, and should be used bearing this in mind. Any scenarios for specific communities should be considered provisional at all times and revised constantly against the most recent and best curated field evidence.**
Expand Down Expand Up @@ -49,7 +59,7 @@ source .venv/bin/activate
To execute the dashboard interface:

```bash
(.venv) python covidserver.py
(.venv) python covidserver.py scenarios/[variant_data_filename]
```

To execute a scenario stored in `scenarios/`:
Expand Down Expand Up @@ -93,7 +103,6 @@ Model callibration requires the best possible clinical data estimates for two pa

To develop scenarios, we strongly recommend starting from the most recently callibrated model that includes policies as well as usin a model without measures as a basis for counterfactual arguments.


## Acknowledgments

The following individuals have contributed directly and indirectly to rapid development of this software package.
Expand Down
112 changes: 112 additions & 0 deletions agent_data_class.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
from scipy.stats import poisson, bernoulli

# The agent class contains all the parameters for an agent
class AgentDataClass:
def __init__(self, model, is_checkpoint, params):
# start from time 0
if not is_checkpoint:
self.age_group = params[1]
self.sex_group = params[2]
self.vaccine_willingness = bernoulli.rvs(model.model_data.vaccinated_percent)
# These are fixed values associated with properties of individuals
self.incubation_time = poisson.rvs(model.model_data.avg_incubation)
self.dwelling_time = poisson.rvs(model.model_data.avg_dwell)
self.recovery_time = poisson.rvs(model.model_data.avg_recovery)
self.prob_contagion = model.model_data.prob_contagion_base
# Mortality in vulnerable population appears to be around day 2-3
self.mortality_value = params[3]
# Severity appears to appear after day 5
self.severity_value = model.model_data.prob_severe/(model.model_data.dwell_15_day*self.recovery_time)
self.curr_dwelling = 0
self.curr_incubation = 0
self.curr_recovery = 0
self.curr_asymptomatic = 0
# Isolation measures are set at the model step level
self.isolated = False
self.isolated_but_inefficient = False
# Contagion probability is local
self.test_chance = 0
# Horrible hack for isolation step
self.in_isolation = False
self.in_distancing = False
self.in_testing = False
self.astep = 0
self.tested = False
self.occupying_bed = False
# Economic assumptions
self.cumul_private_value = 0
self.cumul_public_value = 0
# Employment
self.employed = True
# Contact tracing: this is only available for symptomatic patients
self.tested_traced = False
# All agents
self.contacts = set()
# We assume it takes two full days
self.tracing_delay = 2*model.model_data.dwell_15_day
self.tracing_counter = 0
#vaccination variables
self.vaccinated = False
self.safetymultiplier = 1
self.current_effectiveness = 0
self.vaccination_day = 0
self.vaccine_count = 0
self.dosage_eligible = True
self.fully_vaccinated = False
self.variant = "Standard"
self.variant_immune = {}
for variant in model.model_data.variant_data_list:
self.variant_immune[variant] = False

# start from an existing file
else:
self.age_group = params[2]
self.sex_group = params[3]
self.vaccine_willingness = params[4]
# These are fixed values associated with properties of individuals
self.incubation_time = params[5]
self.dwelling_time = params[6]
self.recovery_time = params[7]
self.prob_contagion = params[8]
# Mortality in vulnerable population appears to be around day 2-3
self.mortality_value = params[9]
# Severity appears to appear after day 5
self.severity_value = params[10]
self.curr_dwelling = params[11]
self.curr_incubation = params[12]
self.curr_recovery = params[13]
self.curr_asymptomatic = params[14]
# Isolation measures are set at the model step level
self.isolated = params[15]
self.isolated_but_inefficient = params[16]
# Contagion probability is local
self.test_chance = params[17]
# Horrible hack for isolation step
self.in_isolation = params[18]
self.in_distancing = params[19]
self.in_testing = params[20]
self.astep = params[21]
self.tested = params[22]
self.occupying_bed = params[23]
# Economic assumptions
self.cumul_private_value = params[24]
self.cumul_public_value = params[25]
# Employment
self.employed = params[26]
# Contact tracing: this is only available for symptomatic patients
self.tested_traced = params[27]
# All agents
self.contacts = params[28]
# We assume it takes two full days
self.tracing_delay = params[29]
self.tracing_counter = params[30]
# vaccination variables
self.vaccinated = params[31]
self.safetymultiplier = params[32]
self.current_effectiveness = params[33]
self.vaccination_day = params[34]
self.vaccine_count = params[35]
self.dosage_eligible = params[36]
self.fully_vaccinated = params[37]
self.variant = params[38]
self.variant_immune = params[39]
20 changes: 20 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/python
from configparser import ConfigParser


def config(filename='database/database.ini', section='postgresql'):
# create a parser
parser = ConfigParser()
# read config file
parser.read(filename)

# get section, default to postgresql
db = {}
if parser.has_section(section):
params = parser.items(section)
for param in params:
db[param[0]] = param[1]
else:
raise Exception('Section {0} not found in the {1} file'.format(section, filename))

return db
Loading