CDCgov / CDCgov/pygriddler

Nested specs

Open
#74 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3
Forks
4
PR merge metrics
No merged PRs in 30d

Description

@KOVALW works a lot with nested Specifications (in the jargon of #68). How to support that in a convenient schema, and whether it should even be in a schema, versus in pure Python, is a discussion I'm diverting here.


Since these parameters are properties of a normal distribution, not necessarily separate parameters, is there any automatic handling that you envision being done by the package or is that supposed to be on the user side? As you know, in a lot of ixa input files, we have Specifications like

{
    "Parameters": {
        "initial_cases": 1,
        "offspring_distribution": {
            "Poisson": {
                "mean": 1.0
              }
         },
        "generation_interval_distribution": {
                "Uniform": {
                    "min": 7.0, "max": 17.0
                 }
          }
  ...
    }
}

which have both atomic parameter values and nested schemes that assign properties to parameter keys.

Our workaround has been to flatten and unflatten nested dictionaries, using only flattened setups for griddles, such as

"offspring_distribution>>>NegativeBinomial>>>concentration": {
            "vary": [0.5, 1.0],
            "if": {
                "equals": {
                    "scenario_offspring_distribution": "NegativeBinomial"
                }
            }
        }

in the v0.3 JSON syntax, and leaving off fixed variable unions until they're combined with a native ixa input file. We then specify overwriting the upper level parameter, such as offspring_distribution in this case, where the whole nested chunk is replaced by the output of each griddle Specification to generate the Experiment set.

Providing this as a method would probably see a lot of common use and it might be worth figuring out a consistent internal method on Experiment so that we don't have to write out long flattened names

Originally posted by @KOVALW in https://github.com/CDCgov/pygriddler/pull/68#discussion_r2143554020

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #68 and the linked workaround in utils.py around line 191, including its flatten/unflatten behavior. The issue names no implementation entry point, tests, or agreed schema; clarify whether nested Specifications belong in the schema or pure Python and define completion criteria before coding.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.