Skip to content

Commit

Permalink
file organization for package creation (#243)
Browse files Browse the repository at this point in the history
* directory reorganization and renaming to src dir

* moving config.py into src and abstract_azure_runner.py into mechanistic_azure

* some comment changes

* removing old experiments

* changing path of sero initializer

* packaging resp_ode draft

* removing unneccessary packagewithin resp_ode

* updating azure related scripts to new packaged resp-ode

* fixing import in shiny apps

* moving azure code into src

* removing config dir out of the package
  • Loading branch information
arik-shurygin authored Sep 23, 2024
1 parent 0a3ba3d commit 4cb75c7
Show file tree
Hide file tree
Showing 63 changed files with 573 additions and 2,443 deletions.
4 changes: 0 additions & 4 deletions .dockerignore

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ testing.py
!config/*.json
!tests/*.json
!exp/*/*.json
!docker_template_configs/*.json
!data/serological-data/*.csv
!data/hospitalization-data/*.csv
!data/vaccination-data/state-spline-fits/*.csv
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ RUN pip install 'poetry==1.8.3'
ENV PATH="/root/.local/bin:/app/:${PATH}"
# set workdir to /app for installing packages
WORKDIR /app
# now copy in the mechanistic model code and config code
COPY ./src/ /app/src
# turn off interaction since we cant type `yes` on the prompts in docker build
RUN poetry install --no-interaction --no-ansi
# now copy in the mechanistic model code and config code
# we will upload the experiment itself into the cloud and refer to from /input
COPY ./mechanistic_model/ /app/mechanistic_model
COPY ./config/config.py /app/config/config.py
COPY ./model_odes/seip_model.py /app/model_odes/seip_model.py
COPY ./mechanistic_azure/abstract_azure_runner.py /app/mechanistic_azure/abstract_azure_runner.py
COPY ./mechanistic_azure/azure_utilities.py /app/mechanistic_azure/azure_utilities.py
49 changes: 46 additions & 3 deletions config/config_initializer_covid.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,50 @@
{
"INITALIZER_NAME": "base initializer covid",
"SEROLOGICAL_DATA_PATH": "data/serological-data/",
"SIM_DATA_PATH": "data/abm-data/abm_population.csv",
"SEROLOGICAL_DATA_PATH": "data/serological-data/sero-initializer-csvs",
"CONTACT_MATRIX_PATH": "data/demographic-data/contact_matrices",
"POP_SIZE": 1000000,
"INITIAL_INFECTIONS": 32000
"INITIAL_INFECTIONS": 32000,
"WANING_PROTECTIONS": [
1.0,
0.942,
0.942,
0.942,
0.0
],
"INFECTIOUS_PERIOD": 7.0,
"EXPOSED_TO_INFECTIOUS": 3.6,
"STRAIN_INTERACTIONS": [
[
1.0,
0.7,
0.49
],
[
0.7,
1.0,
0.7
],
[
0.49,
0.7,
1.0
]
],
"VACCINE_EFF_MATRIX": [
[
0,
0.34,
0.68
],
[
0,
0.24,
0.48
],
[
0,
0.14,
0.28
]
]
}
50 changes: 0 additions & 50 deletions config/config_initializer_covid_sero.json

This file was deleted.

18 changes: 11 additions & 7 deletions example_end_to_end_run.py → examples/example_end_to_end_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

# the different segments of code responsible for runing the model
# each will be explained as they are used below
from mechanistic_model.covid_initializer import CovidInitializer
from mechanistic_model.mechanistic_inferer import MechanisticInferer
from mechanistic_model.mechanistic_runner import MechanisticRunner
from mechanistic_model.solution_iterpreter import SolutionInterpreter
from mechanistic_model.static_value_parameters import StaticValueParameters
from model_odes.seip_model import seip_ode
from resp_ode import (
CovidSeroInitializer,
MechanisticInferer,
MechanisticRunner,
SolutionInterpreter,
StaticValueParameters,
)
from resp_ode.model_odes import seip_ode

parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down Expand Up @@ -51,7 +53,9 @@

# step 2: Set up your initializer
# sets up the initial conditions, initializer.get_initial_state() passed to runner
initializer = CovidInitializer(INITIALIZER_CONFIG_PATH, GLOBAL_CONFIG_PATH)
initializer = CovidSeroInitializer(
INITIALIZER_CONFIG_PATH, GLOBAL_CONFIG_PATH
)

# step 3: set up your parameters object
# reads and interprets values from config, sets up downstream parameters
Expand Down
14 changes: 8 additions & 6 deletions exp/example_azure_experiment/run_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@

sys.path.append("/app/")

from mechanistic_model.abstract_azure_runner import AbstractAzureRunner
from mechanistic_model.covid_sero_initializer import CovidSeroInitializer
from mechanistic_model.mechanistic_inferer import MechanisticInferer
from mechanistic_model.mechanistic_runner import MechanisticRunner
from mechanistic_model.static_value_parameters import StaticValueParameters
from model_odes.seip_model import seip_ode
from mechanistic_azure.abstract_azure_runner import AbstractAzureRunner
from resp_ode import (
CovidSeroInitializer,
MechanisticInferer,
MechanisticRunner,
StaticValueParameters,
)
from resp_ode.model_odes import seip_ode


class ExampleRunner(AbstractAzureRunner):
Expand Down
58 changes: 0 additions & 58 deletions exp/fit_1strain_varybeta/config_inferer.json

This file was deleted.

53 changes: 0 additions & 53 deletions exp/fit_1strain_varybeta/config_runner.json

This file was deleted.

Loading

0 comments on commit 4cb75c7

Please sign in to comment.