Application Context¶
Each model run needs to have an object that determines the file structure, connections to the IHME databases, etc.
This context can be modified for a local environment, but that’s not currently implemented in an intuitive or user-friendly way. When we want to enable local runs of an entire cascade, this configuration is what we need to do design work on.
Configuration¶
There is an additional repository that stores application information for the IHME configuration.
Context¶
Based on the configuration above, and a model version ID from the epi database, we define a context object that keeps track of database connections and file structures.
-
class
cascade_at.context.model_context.
Context
(model_version_id, make=False, configure_application=True, root_directory=None)[source]¶ Bases:
object
Context for running a model.
- Parameters
model_version_id (
int
) – The model version ID for this context. If you’re not configuring the application, doesn’t matter what this is.make (
bool
) – Whether or not the make the directory tree for the model.configure_application (
bool
) – Configure the production application. If False, this can be used for testing on a local machine.
-
db_file
(location_id, sex_id)[source]¶ Gets the database file for a given location and sex.
- Parameters
location_id (
int
) – Location ID for the database (parent).sex_id (
int
) – Sex ID for the database, as the reference.
- Return type
Path
-
db_index_file_pattern
(location_id, sex_id)[source]¶ Gets the database file pattern for databases with indices. Used in sample simulate when it’s done in parallel.
- Parameters
location_id (
int
) – Location ID for the database (parent).sex_id (
int
) – Sex ID for the database, as the reference.
- Returns
- Return type
String representing the absolute path to the index database.
It also provides methods to read in the three things that are always needed to construct models: