VisionEval / VisionEval-Dev

Development version of VisionEval framework
https://visioneval.github.io/
Apache License 2.0
6 stars 32 forks source link

Dynamic Specifications for Modules (using function rather than hard-coded data) #193

Closed jrawbits closed 1 year ago

jrawbits commented 1 year ago

This pull request changes the VisionEval framework to support Module Specifications generated by a function, rather than hard-coded into the module package's data directory. You still have a hard coded Specifications data file, but it contains the name of a function rather than data specs. When the function is called by the framework, it returns a list of module specifications.

A new framework package, called VESnapshot, illustrates how to implement dynamic module specifications. Once you have installed VESnapshot (and the new versions of visioneval and VEModel), you can use installModel to install the model called "VESnap" (variant "base") and it will run a very brief model with the "Dynamic" module (the bare bones implementation of things one needs to (or should) do to implement dynamic module specifications). I'll add other test model variants later to show alternative configurations for Dynamic, and to round out the Snapshot module. See details below.

The mechanism is intended to be used in the VEPopulationSim bridge module (walking data into VIsionEval from a comatibly configured PopulationSim instance). This pull request includes framework changes plus a new package called VESnapshot that illustrates how to do dynamic specifications. In particular, there is a module in VESnapshot called "Dynamic" that explains everything (read the source and comment sections there).

The Dynamic module doesn't do anything useful (just prints a message, and optionally applies a function to a single Datastore field to compute some summary statistic). The module can be configured to select a different field, or print a different message. The configuration is through visioneval.cnf (or a separate visioneval.cnf just for Dynamic).

There is also a stub for a "Snapshot" module that will eventually do something useful: copying a field from the Datastore to a field with a different name while the model is running, so the state of the data can be captured before it is overwritten by a later module. I introduced a new optional "Instance" parameter for the runModule function so the same dynamic specificaiton module can be run multiple times during a model run and do different things each time (based on configura.tions associated with the Module plus the Instance).

I have modules compiled for R 4.1.3, and I will move this up to 4.2.2 once it has stabiliaed. Email jeremy.raw at dot.gov or put a comment on the pull request if you need the modules (it will build everything if you run ve.build() on the Github, including the VESnapshot module.

jrawbits commented 1 year ago

I'll be updating this pull request soon to rebase on VisionEval 3.0 pull-request ("r42") with updated and completed modules for doing Datastore snapshots and illustrating dynamic module specifications.

jrawbits commented 1 year ago

The functionality has been moved to the "r42" branch, so I'm closing this pull request.