Meta-model

Template model (mira.metamodel.template_model)

pydantic model Annotations[source]

Bases: BaseModel

A metadata model for model-level annotations.

Examples in this metadata model are taken from https://www.ebi.ac.uk/biomodels/BIOMD0000000956, a well-annotated SIR model in the BioModels database.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "Annotations",
   "description": "A metadata model for model-level annotations.\n\nExamples in this metadata model are taken from\nhttps://www.ebi.ac.uk/biomodels/BIOMD0000000956,\na well-annotated SIR model in the BioModels database.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "description": "A human-readable label for the model",
         "example": "SIR model of scenarios of COVID-19 spread in CA and NY",
         "type": "string"
      },
      "description": {
         "title": "Description",
         "description": "A description of the model",
         "example": "The coronavirus disease 2019 (COVID-19) pandemic has placed epidemic modeling at the forefront of worldwide public policy making. Nonetheless, modeling and forecasting the spread of COVID-19 remains a challenge. Here, we detail three regional scale models for forecasting and assessing the course of the pandemic. This work demonstrates the utility of parsimonious models for early-time data and provides an accessible framework for generating policy-relevant insights into its course. We show how these models can be connected to each other and to time series data for a particular region. Capable of measuring and forecasting the impacts of social distancing, these models highlight the dangers of relaxing nonpharmaceutical public health interventions in the absence of a vaccine or antiviral therapies.",
         "type": "string"
      },
      "license": {
         "title": "License",
         "description": "Information about the licensing of the model artifact. Ideally, given as an SPDX identifier like CC0 or CC-BY-4.0. For example, models from the BioModels databases are all licensed under the CC0 public attribution license.",
         "example": "CC0",
         "type": "string"
      },
      "authors": {
         "title": "Authors",
         "description": "A list of authors/creators of the model. This is not the same as the people who e.g., submitted the model to BioModels",
         "example": [
            "name='Andrea L Bertozzi'",
            "name='Elisa Franco'",
            "name='George Mohler'",
            "name='Martin B Short'",
            "name='Daniel Sledge'"
         ],
         "type": "array",
         "items": {
            "$ref": "#/definitions/Author"
         }
      },
      "references": {
         "title": "References",
         "description": "A list of CURIEs (i.e., <prefix>:<identifier>) corresponding to literature references that describe the model. Do **not** duplicate the same publication with different CURIEs (e.g., using pubmed, pmc, and doi)",
         "example": [
            "pubmed:32616574"
         ],
         "type": "array",
         "items": {
            "type": "string"
         }
      },
      "time_scale": {
         "title": "Time Scale",
         "description": "The granularity of the time element of the model, typically on the scale of days, weeks, or months for epidemiology models",
         "example": "day",
         "type": "string"
      },
      "time_start": {
         "title": "Time Start",
         "description": "The start time of the applicability of a model, given as a datetime. When the time scale is not so granular, leave the less granular fields as default, i.e., if the time scale is on months, give dates like YYYY-MM-01 00:00",
         "type": "string",
         "format": "date-time"
      },
      "time_end": {
         "title": "Time End",
         "description": "Similar to the start time of the applicability of a model, the end time is given as a datetime. For example, the Bertozzi 2020 model is applicable between March and August 2020, so this field is annotated with August 1st, 2020.",
         "type": "string",
         "format": "date-time"
      },
      "locations": {
         "title": "Locations",
         "description": "A location or list of locations where this model is applicable, ideally annotated using a CURIEs referencing a controlled vocabulary such as GeoNames, which has multiple levels of granularity including city/state/country level terms. For example,the Bertozzi 2020 model was for New York City (geonames:5128581) and California (geonames:5332921)",
         "example": [
            "geonames:5128581",
            "geonames:5332921"
         ],
         "type": "array",
         "items": {
            "type": "string"
         }
      },
      "pathogens": {
         "title": "Pathogens",
         "description": "The pathogens present in the model, given with CURIEs referencing vocabulary for taxa, ideally, NCBI Taxonomy. For example, the Bertozzi 2020 model is about SARS-CoV-2, this is ncbitaxon:2697049. Do not confuse this field with terms for annotating the disease caused by the pathogen. Note that some models may have multiple pathogens, for simulating double pandemics such as the interaction with SARS-CoV-2 and the seasonal flu.",
         "example": [
            "ncbitaxon:2697049"
         ],
         "type": "array",
         "items": {
            "type": "string"
         }
      },
      "diseases": {
         "title": "Diseases",
         "description": "The diseases caused by pathogens in the model, given with CURIEs referencing vocabulary for dieases, such as DOID, EFO, or MONDO. For example, the Bertozzi 2020 model is about SARS-CoV-2, which causes COVID-19. In the Human Disease Ontology (DOID), this is referenced by doid:0080600.",
         "example": [
            "doid:0080600"
         ],
         "type": "array",
         "items": {
            "type": "string"
         }
      },
      "hosts": {
         "title": "Hosts",
         "description": "The hosts present in the model, given with CURIEs referencing vocabulary for taxa, ideally, NCBI Taxonomy. For example, the Bertozzi 2020 model is about human infection by SARS-CoV-2. Therefore, the appropriate annotation for this field would be ncbitaxon:9606. Note that some models have multiple hosts, such as Malaria models that consider humans and mosquitos.",
         "example": [
            "ncbitaxon:9606"
         ],
         "type": "array",
         "items": {
            "type": "string"
         }
      },
      "model_types": {
         "title": "Model Types",
         "description": "This field describes the type(s) of the model using the Mathematical Modeling Ontology (MAMO), which has terms like 'ordinary differential equation  model', 'population model', etc. These should be annotated as CURIEs in the form of mamo:<local unique identifier>. For example, the Bertozzi 2020 model is a population model (mamo:0000028) and ordinary differential equation model (mamo:0000046)",
         "example": [
            "mamo:0000028",
            "mamo:0000046"
         ],
         "type": "array",
         "items": {
            "type": "string"
         }
      }
   },
   "definitions": {
      "Author": {
         "title": "Author",
         "description": "A metadata model for an author.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the author",
               "type": "string"
            }
         },
         "required": [
            "name"
         ]
      }
   }
}

Fields:
field authors: List[Author] [Optional]

A list of authors/creators of the model. This is not the same as the people who e.g., submitted the model to BioModels

field description: Optional[str] = None

A description of the model

field diseases: List[str] [Optional]

The diseases caused by pathogens in the model, given with CURIEs referencing vocabulary for dieases, such as DOID, EFO, or MONDO. For example, the Bertozzi 2020 model is about SARS-CoV-2, which causes COVID-19. In the Human Disease Ontology (DOID), this is referenced by doid:0080600.

field hosts: List[str] [Optional]

The hosts present in the model, given with CURIEs referencing vocabulary for taxa, ideally, NCBI Taxonomy. For example, the Bertozzi 2020 model is about human infection by SARS-CoV-2. Therefore, the appropriate annotation for this field would be ncbitaxon:9606. Note that some models have multiple hosts, such as Malaria models that consider humans and mosquitos.

field license: Optional[str] = None

Information about the licensing of the model artifact. Ideally, given as an SPDX identifier like CC0 or CC-BY-4.0. For example, models from the BioModels databases are all licensed under the CC0 public attribution license.

field locations: List[str] [Optional]

A location or list of locations where this model is applicable, ideally annotated using a CURIEs referencing a controlled vocabulary such as GeoNames, which has multiple levels of granularity including city/state/country level terms. For example,the Bertozzi 2020 model was for New York City (geonames:5128581) and California (geonames:5332921)

field model_types: List[str] [Optional]

This field describes the type(s) of the model using the Mathematical Modeling Ontology (MAMO), which has terms like ‘ordinary differential equation model’, ‘population model’, etc. These should be annotated as CURIEs in the form of mamo:<local unique identifier>. For example, the Bertozzi 2020 model is a population model (mamo:0000028) and ordinary differential equation model (mamo:0000046)

field name: Optional[str] = None

A human-readable label for the model

field pathogens: List[str] [Optional]

The pathogens present in the model, given with CURIEs referencing vocabulary for taxa, ideally, NCBI Taxonomy. For example, the Bertozzi 2020 model is about SARS-CoV-2, this is ncbitaxon:2697049. Do not confuse this field with terms for annotating the disease caused by the pathogen. Note that some models may have multiple pathogens, for simulating double pandemics such as the interaction with SARS-CoV-2 and the seasonal flu.

field references: List[str] [Optional]

A list of CURIEs (i.e., <prefix>:<identifier>) corresponding to literature references that describe the model. Do not duplicate the same publication with different CURIEs (e.g., using pubmed, pmc, and doi)

field time_end: Optional[datetime] = None

Similar to the start time of the applicability of a model, the end time is given as a datetime. For example, the Bertozzi 2020 model is applicable between March and August 2020, so this field is annotated with August 1st, 2020.

field time_scale: Optional[str] = None

The granularity of the time element of the model, typically on the scale of days, weeks, or months for epidemiology models

field time_start: Optional[datetime] = None

The start time of the applicability of a model, given as a datetime. When the time scale is not so granular, leave the less granular fields as default, i.e., if the time scale is on months, give dates like YYYY-MM-01 00:00

pydantic model TemplateModel[source]

Bases: BaseModel

A template model.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "TemplateModel",
   "description": "A template model.",
   "type": "object",
   "properties": {
      "templates": {
         "title": "Templates",
         "description": "A list of any child class of Templates",
         "type": "array",
         "items": {
            "discriminator": {
               "propertyName": "type",
               "mapping": {
                  "NaturalConversion": "#/definitions/NaturalConversion",
                  "ControlledConversion": "#/definitions/ControlledConversion",
                  "NaturalDegradation": "#/definitions/NaturalDegradation",
                  "ControlledDegradation": "#/definitions/ControlledDegradation",
                  "GroupedControlledDegradation": "#/definitions/GroupedControlledDegradation",
                  "NaturalProduction": "#/definitions/NaturalProduction",
                  "ControlledProduction": "#/definitions/ControlledProduction",
                  "GroupedControlledConversion": "#/definitions/GroupedControlledConversion",
                  "GroupedControlledProduction": "#/definitions/GroupedControlledProduction"
               }
            },
            "oneOf": [
               {
                  "$ref": "#/definitions/NaturalConversion"
               },
               {
                  "$ref": "#/definitions/ControlledConversion"
               },
               {
                  "$ref": "#/definitions/NaturalDegradation"
               },
               {
                  "$ref": "#/definitions/ControlledDegradation"
               },
               {
                  "$ref": "#/definitions/GroupedControlledDegradation"
               },
               {
                  "$ref": "#/definitions/NaturalProduction"
               },
               {
                  "$ref": "#/definitions/ControlledProduction"
               },
               {
                  "$ref": "#/definitions/GroupedControlledConversion"
               },
               {
                  "$ref": "#/definitions/GroupedControlledProduction"
               }
            ]
         }
      },
      "parameters": {
         "title": "Parameters",
         "description": "A dict of parameter values where keys correspond to how the parameter appears in rate laws.",
         "type": "object",
         "additionalProperties": {
            "$ref": "#/definitions/Parameter"
         }
      },
      "initials": {
         "title": "Initials",
         "description": "A dict of initial condition values where keyscorrespond to concept names they apply to.",
         "type": "object",
         "additionalProperties": {
            "$ref": "#/definitions/Initial"
         }
      },
      "observables": {
         "title": "Observables",
         "description": "A list of observables that are readouts from the model.",
         "type": "object",
         "additionalProperties": {
            "$ref": "#/definitions/Observable"
         }
      },
      "annotations": {
         "title": "Annotations",
         "description": "A structure containing model-level annotations. Note that all annotations are optional.",
         "allOf": [
            {
               "$ref": "#/definitions/Annotations"
            }
         ]
      },
      "time": {
         "title": "Time",
         "description": "A structure containing time-related annotations. Note that all annotations are optional.",
         "allOf": [
            {
               "$ref": "#/definitions/Time"
            }
         ]
      }
   },
   "required": [
      "templates"
   ],
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      },
      "Concept": {
         "title": "Concept",
         "description": "A concept is specified by its identifier(s), name, and - optionally -\nits context.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      },
      "Provenance": {
         "title": "Provenance",
         "type": "object",
         "properties": {}
      },
      "NaturalConversion": {
         "title": "NaturalConversion",
         "description": "Specifies a process of natural conversion from subject to outcome",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "NaturalConversion",
               "const": "NaturalConversion",
               "enum": [
                  "NaturalConversion"
               ],
               "type": "string"
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "subject",
            "outcome"
         ]
      },
      "ControlledConversion": {
         "title": "ControlledConversion",
         "description": "Specifies a process of controlled conversion from subject to outcome,\ncontrolled by the controller.",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "ControlledConversion",
               "const": "ControlledConversion",
               "enum": [
                  "ControlledConversion"
               ],
               "type": "string"
            },
            "controller": {
               "$ref": "#/definitions/Concept"
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controller",
            "subject",
            "outcome"
         ]
      },
      "NaturalDegradation": {
         "title": "NaturalDegradation",
         "description": "A template for the degradataion of a species at a proportional rate to its amount.",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "NaturalDegradation",
               "const": "NaturalDegradation",
               "enum": [
                  "NaturalDegradation"
               ],
               "type": "string"
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "subject"
         ]
      },
      "ControlledDegradation": {
         "title": "ControlledDegradation",
         "description": "Specifies a process of degradation controlled by one controller",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "ControlledDegradation",
               "const": "ControlledDegradation",
               "enum": [
                  "ControlledDegradation"
               ],
               "type": "string"
            },
            "controller": {
               "$ref": "#/definitions/Concept"
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controller",
            "subject"
         ]
      },
      "GroupedControlledDegradation": {
         "title": "GroupedControlledDegradation",
         "description": "Specifies a process of degradation controlled by several controllers",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "GroupedControlledDegradation",
               "const": "GroupedControlledDegradation",
               "enum": [
                  "GroupedControlledDegradation"
               ],
               "type": "string"
            },
            "controllers": {
               "title": "Controllers",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Concept"
               }
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controllers",
            "subject"
         ]
      },
      "NaturalProduction": {
         "title": "NaturalProduction",
         "description": "A template for the production of a species at a constant rate.",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "NaturalProduction",
               "const": "NaturalProduction",
               "enum": [
                  "NaturalProduction"
               ],
               "type": "string"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "outcome"
         ]
      },
      "ControlledProduction": {
         "title": "ControlledProduction",
         "description": "Specifies a process of production controlled by one controller",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "ControlledProduction",
               "const": "ControlledProduction",
               "enum": [
                  "ControlledProduction"
               ],
               "type": "string"
            },
            "controller": {
               "$ref": "#/definitions/Concept"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controller",
            "outcome"
         ]
      },
      "GroupedControlledConversion": {
         "title": "GroupedControlledConversion",
         "description": "The Template is a parent class for model processes",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "GroupedControlledConversion",
               "const": "GroupedControlledConversion",
               "enum": [
                  "GroupedControlledConversion"
               ],
               "type": "string"
            },
            "controllers": {
               "title": "Controllers",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Concept"
               }
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controllers",
            "subject",
            "outcome"
         ]
      },
      "GroupedControlledProduction": {
         "title": "GroupedControlledProduction",
         "description": "Specifies a process of production controlled by several controllers",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "GroupedControlledProduction",
               "const": "GroupedControlledProduction",
               "enum": [
                  "GroupedControlledProduction"
               ],
               "type": "string"
            },
            "controllers": {
               "title": "Controllers",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Concept"
               }
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controllers",
            "outcome"
         ]
      },
      "Distribution": {
         "title": "Distribution",
         "description": "A distribution of values for a parameter.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "description": "The type of distribution, e.g. 'uniform', 'normal', etc.",
               "type": "string"
            },
            "parameters": {
               "title": "Parameters",
               "description": "The parameters of the distribution.",
               "type": "object",
               "additionalProperties": {
                  "type": "number"
               }
            }
         },
         "required": [
            "type",
            "parameters"
         ]
      },
      "Parameter": {
         "title": "Parameter",
         "description": "A Parameter is a special type of Concept that carries a value.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            },
            "value": {
               "title": "Value",
               "description": "Value of the parameter.",
               "type": "number"
            },
            "distribution": {
               "title": "Distribution",
               "description": "A distribution of values for the parameter.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Distribution"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      },
      "Initial": {
         "title": "Initial",
         "description": "An initial condition.",
         "type": "object",
         "properties": {
            "concept": {
               "$ref": "#/definitions/Concept"
            },
            "value": {
               "title": "Value",
               "type": "number"
            }
         },
         "required": [
            "concept",
            "value"
         ]
      },
      "Observable": {
         "title": "Observable",
         "description": "An observable is a special type of Concept that carries an expression.\n\nObservables are used to define the readouts of a model, useful when a\nreadout is not defined as a state variable but is rather a function of\nstate variables.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            },
            "expression": {
               "title": "Expression",
               "description": "The expression for the observable.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "name",
            "expression"
         ]
      },
      "Author": {
         "title": "Author",
         "description": "A metadata model for an author.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the author",
               "type": "string"
            }
         },
         "required": [
            "name"
         ]
      },
      "Annotations": {
         "title": "Annotations",
         "description": "A metadata model for model-level annotations.\n\nExamples in this metadata model are taken from\nhttps://www.ebi.ac.uk/biomodels/BIOMD0000000956,\na well-annotated SIR model in the BioModels database.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "A human-readable label for the model",
               "example": "SIR model of scenarios of COVID-19 spread in CA and NY",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "A description of the model",
               "example": "The coronavirus disease 2019 (COVID-19) pandemic has placed epidemic modeling at the forefront of worldwide public policy making. Nonetheless, modeling and forecasting the spread of COVID-19 remains a challenge. Here, we detail three regional scale models for forecasting and assessing the course of the pandemic. This work demonstrates the utility of parsimonious models for early-time data and provides an accessible framework for generating policy-relevant insights into its course. We show how these models can be connected to each other and to time series data for a particular region. Capable of measuring and forecasting the impacts of social distancing, these models highlight the dangers of relaxing nonpharmaceutical public health interventions in the absence of a vaccine or antiviral therapies.",
               "type": "string"
            },
            "license": {
               "title": "License",
               "description": "Information about the licensing of the model artifact. Ideally, given as an SPDX identifier like CC0 or CC-BY-4.0. For example, models from the BioModels databases are all licensed under the CC0 public attribution license.",
               "example": "CC0",
               "type": "string"
            },
            "authors": {
               "title": "Authors",
               "description": "A list of authors/creators of the model. This is not the same as the people who e.g., submitted the model to BioModels",
               "example": [
                  "name='Andrea L Bertozzi'",
                  "name='Elisa Franco'",
                  "name='George Mohler'",
                  "name='Martin B Short'",
                  "name='Daniel Sledge'"
               ],
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Author"
               }
            },
            "references": {
               "title": "References",
               "description": "A list of CURIEs (i.e., <prefix>:<identifier>) corresponding to literature references that describe the model. Do **not** duplicate the same publication with different CURIEs (e.g., using pubmed, pmc, and doi)",
               "example": [
                  "pubmed:32616574"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "time_scale": {
               "title": "Time Scale",
               "description": "The granularity of the time element of the model, typically on the scale of days, weeks, or months for epidemiology models",
               "example": "day",
               "type": "string"
            },
            "time_start": {
               "title": "Time Start",
               "description": "The start time of the applicability of a model, given as a datetime. When the time scale is not so granular, leave the less granular fields as default, i.e., if the time scale is on months, give dates like YYYY-MM-01 00:00",
               "type": "string",
               "format": "date-time"
            },
            "time_end": {
               "title": "Time End",
               "description": "Similar to the start time of the applicability of a model, the end time is given as a datetime. For example, the Bertozzi 2020 model is applicable between March and August 2020, so this field is annotated with August 1st, 2020.",
               "type": "string",
               "format": "date-time"
            },
            "locations": {
               "title": "Locations",
               "description": "A location or list of locations where this model is applicable, ideally annotated using a CURIEs referencing a controlled vocabulary such as GeoNames, which has multiple levels of granularity including city/state/country level terms. For example,the Bertozzi 2020 model was for New York City (geonames:5128581) and California (geonames:5332921)",
               "example": [
                  "geonames:5128581",
                  "geonames:5332921"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "pathogens": {
               "title": "Pathogens",
               "description": "The pathogens present in the model, given with CURIEs referencing vocabulary for taxa, ideally, NCBI Taxonomy. For example, the Bertozzi 2020 model is about SARS-CoV-2, this is ncbitaxon:2697049. Do not confuse this field with terms for annotating the disease caused by the pathogen. Note that some models may have multiple pathogens, for simulating double pandemics such as the interaction with SARS-CoV-2 and the seasonal flu.",
               "example": [
                  "ncbitaxon:2697049"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "diseases": {
               "title": "Diseases",
               "description": "The diseases caused by pathogens in the model, given with CURIEs referencing vocabulary for dieases, such as DOID, EFO, or MONDO. For example, the Bertozzi 2020 model is about SARS-CoV-2, which causes COVID-19. In the Human Disease Ontology (DOID), this is referenced by doid:0080600.",
               "example": [
                  "doid:0080600"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "hosts": {
               "title": "Hosts",
               "description": "The hosts present in the model, given with CURIEs referencing vocabulary for taxa, ideally, NCBI Taxonomy. For example, the Bertozzi 2020 model is about human infection by SARS-CoV-2. Therefore, the appropriate annotation for this field would be ncbitaxon:9606. Note that some models have multiple hosts, such as Malaria models that consider humans and mosquitos.",
               "example": [
                  "ncbitaxon:9606"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "model_types": {
               "title": "Model Types",
               "description": "This field describes the type(s) of the model using the Mathematical Modeling Ontology (MAMO), which has terms like 'ordinary differential equation  model', 'population model', etc. These should be annotated as CURIEs in the form of mamo:<local unique identifier>. For example, the Bertozzi 2020 model is a population model (mamo:0000028) and ordinary differential equation model (mamo:0000046)",
               "example": [
                  "mamo:0000028",
                  "mamo:0000046"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            }
         }
      },
      "Time": {
         "title": "Time",
         "description": "A special type of Concept that represents time.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The symbol of the time variable in the model.",
               "default": "t",
               "type": "string"
            },
            "units": {
               "title": "Units",
               "description": "The units of the time variable.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            }
         }
      }
   }
}

Config:
  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function TemplateModel.Config.<lambda> at 0x7fe103ca31f0>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function TemplateModel.Config.<lambda> at 0x7fe103ca30d0>}

Fields:
field annotations: Optional[Annotations] = None

A structure containing model-level annotations. Note that all annotations are optional.

field initials: Dict[str, Initial] [Optional]

A dict of initial condition values where keyscorrespond to concept names they apply to.

field observables: Dict[str, Observable] [Optional]

A list of observables that are readouts from the model.

field parameters: Dict[str, Parameter] [Optional]

A dict of parameter values where keys correspond to how the parameter appears in rate laws.

field templates: List[AnnotatedAlias[Union[NaturalConversion, ControlledConversion, NaturalDegradation, ControlledDegradation, GroupedControlledDegradation, NaturalProduction, ControlledProduction, GroupedControlledConversion, GroupedControlledProduction]]] [Required]

A list of any child class of Templates

field time: Optional[Time] = None

A structure containing time-related annotations. Note that all annotations are optional.

add_template(template, parameter_mapping=None, initial_mapping=None)[source]

Add a template to the model

Parameters:
  • template (Template) – The template to add

  • parameter_mapping (Optional[Mapping[str, Parameter]]) – A mapping from parameter names in the template to Parameter instances in the model.

  • initial_mapping (Optional[Mapping[str, Initial]]) – A mapping from concept names in the template to Initial instances in the model

Return type:

TemplateModel

Returns:

A new model with the additional template

add_transition(subject_concept, outcome_concept, parameter=None)[source]

Add a NaturalConversion between a source and an outcome.

We assume mass action kinetics with a single parameter.

Return type:

TemplateModel

draw_graph(path, prog='dot', args='', format=None)[source]

Draw a pygraphviz graph of the TemplateModel

Parameters:
  • path (str) – The path to the output file

  • prog (str) – The graphviz layout program to use, such as “dot”, “neato”, etc.

  • format (Optional[str]) – Set the file format explicitly

  • args (str) – Additional arguments to pass to the graphviz bash program as a string. Example: args=”-Nshape=box -Edir=forward -Ecolor=red”

draw_jupyter(path='model.png', prog='dot', args='', format=None)[source]

Display in jupyter.

eliminate_duplicate_parameter(redundant_parameter, preserved_parameter)[source]

Eliminate a duplicate parameter from the model.

This happens when there are two redundant parameters only one of which is actually used in the model. This function removes the redundant parameter and updates the rate laws to use the preserved parameter.

eliminate_parameter(name)[source]

Eliminate a parameter from the model by substituting 0.

eliminate_unused_parameters()[source]

Remove parameters that are not used in rate laws.

extend(template_model, parameter_mapping=None, initial_mapping=None)[source]

Extend this template model with another template model.

classmethod from_json(data)[source]
Return type:

TemplateModel

generate_model_graph()[source]
Return type:

DiGraph

get_all_used_parameters()[source]

Get all parameters that are actually used in rate laws.

get_concept(name)[source]

Return the first concept that has the given name.

Return type:

Optional[Concept]

get_concepts_by_name(name)[source]

Return a list of all concepts that have the given name. :rtype: List[Concept]

Warning

this could give duplicates if there are nodes with compositional grounding

get_concepts_map()[source]

Return a mapping from concept keys to concepts that appear in this template model’s templates.

get_concepts_name_map()[source]

Return a mapping from concept names to concepts that appear in this template model’s templates.

get_parameters_from_rate_law(rate_law)[source]

Given a rate law, find its elements that are model parameters.

Rate laws consist of some combination of participants, rate parameters and potentially other factors. This function finds those elements of rate laws that are rate parameters.

Parameters:

rate_law – A sympy expression or symbol, whose names are extracted

Return type:

Set[str]

Returns:

A set of parameter names (as strings)

graph_as_json()[source]

Serialize the TemaplateModel graph as node-link data

Return type:

Dict

print_params_table()[source]
reset_base_names()[source]

Reset the base names of all concepts in this model to the current name.

set_initials(initial_dict)[source]

Set the initials of this model to the values in the given dict.

set_parameters(param_dict)[source]

Set the parameters of this model to the values in the given dict.

substitute_parameter(name, value=None)[source]

Substitute a parameter with a value.

update_parameters(parameter_dict)[source]
pydantic model Initial[source]

Bases: BaseModel

An initial condition.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "Initial",
   "description": "An initial condition.",
   "type": "object",
   "properties": {
      "concept": {
         "$ref": "#/definitions/Concept"
      },
      "value": {
         "title": "Value",
         "type": "number"
      }
   },
   "required": [
      "concept",
      "value"
   ],
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      },
      "Concept": {
         "title": "Concept",
         "description": "A concept is specified by its identifier(s), name, and - optionally -\nits context.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Initial.Config.<lambda> at 0x7fe103d05dc0>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Initial.Config.<lambda> at 0x7fe103d05d30>}

Fields:
field concept: Concept [Required]
field value: float [Required]
classmethod from_json(data)[source]
Return type:

Initial

pydantic model Parameter[source]

Bases: Concept

A Parameter is a special type of Concept that carries a value.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "Parameter",
   "description": "A Parameter is a special type of Concept that carries a value.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "description": "The name of the concept.",
         "type": "string"
      },
      "display_name": {
         "title": "Display Name",
         "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
         "type": "string"
      },
      "description": {
         "title": "Description",
         "description": "An optional description of the concept.",
         "type": "string"
      },
      "identifiers": {
         "title": "Identifiers",
         "description": "A mapping of namespaces to identifiers.",
         "type": "object",
         "additionalProperties": {
            "type": "string"
         }
      },
      "context": {
         "title": "Context",
         "description": "A mapping of context keys to values.",
         "type": "object",
         "additionalProperties": {
            "type": "string"
         }
      },
      "units": {
         "title": "Units",
         "description": "The units of the concept.",
         "allOf": [
            {
               "$ref": "#/definitions/Unit"
            }
         ]
      },
      "value": {
         "title": "Value",
         "description": "Value of the parameter.",
         "type": "number"
      },
      "distribution": {
         "title": "Distribution",
         "description": "A distribution of values for the parameter.",
         "allOf": [
            {
               "$ref": "#/definitions/Distribution"
            }
         ]
      }
   },
   "required": [
      "name"
   ],
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      },
      "Distribution": {
         "title": "Distribution",
         "description": "A distribution of values for a parameter.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "description": "The type of distribution, e.g. 'uniform', 'normal', etc.",
               "type": "string"
            },
            "parameters": {
               "title": "Parameters",
               "description": "The parameters of the distribution.",
               "type": "object",
               "additionalProperties": {
                  "type": "number"
               }
            }
         },
         "required": [
            "type",
            "parameters"
         ]
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Concept.Config.<lambda> at 0x7fe103dcd280>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Concept.Config.<lambda> at 0x7fe103dbfc10>}

Fields:
field distribution: Optional[Distribution] = None

A distribution of values for the parameter.

field value: Optional[float] = None

Value of the parameter.

pydantic model Distribution[source]

Bases: BaseModel

A distribution of values for a parameter.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "Distribution",
   "description": "A distribution of values for a parameter.",
   "type": "object",
   "properties": {
      "type": {
         "title": "Type",
         "description": "The type of distribution, e.g. 'uniform', 'normal', etc.",
         "type": "string"
      },
      "parameters": {
         "title": "Parameters",
         "description": "The parameters of the distribution.",
         "type": "object",
         "additionalProperties": {
            "type": "number"
         }
      }
   },
   "required": [
      "type",
      "parameters"
   ]
}

Fields:
field parameters: Dict[str, float] [Required]

The parameters of the distribution.

field type: str [Required]

The type of distribution, e.g. ‘uniform’, ‘normal’, etc.

pydantic model Observable[source]

Bases: Concept

An observable is a special type of Concept that carries an expression.

Observables are used to define the readouts of a model, useful when a readout is not defined as a state variable but is rather a function of state variables.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "Observable",
   "description": "An observable is a special type of Concept that carries an expression.\n\nObservables are used to define the readouts of a model, useful when a\nreadout is not defined as a state variable but is rather a function of\nstate variables.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "description": "The name of the concept.",
         "type": "string"
      },
      "display_name": {
         "title": "Display Name",
         "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
         "type": "string"
      },
      "description": {
         "title": "Description",
         "description": "An optional description of the concept.",
         "type": "string"
      },
      "identifiers": {
         "title": "Identifiers",
         "description": "A mapping of namespaces to identifiers.",
         "type": "object",
         "additionalProperties": {
            "type": "string"
         }
      },
      "context": {
         "title": "Context",
         "description": "A mapping of context keys to values.",
         "type": "object",
         "additionalProperties": {
            "type": "string"
         }
      },
      "units": {
         "title": "Units",
         "description": "The units of the concept.",
         "allOf": [
            {
               "$ref": "#/definitions/Unit"
            }
         ]
      },
      "expression": {
         "title": "Expression",
         "description": "The expression for the observable.",
         "type": "string",
         "example": "2*x"
      }
   },
   "required": [
      "name",
      "expression"
   ],
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Observable.Config.<lambda> at 0x7fe103d05f70>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Observable.Config.<lambda> at 0x7fe103d05e50>}

Fields:
field expression: SympyExprStr [Required]

The expression for the observable.

Constraints:
  • type = string

  • example = 2*x

get_parameter_names(known_param_names)[source]

Get the names of all parameters in the expression.

Return type:

Set[str]

substitute_parameter(name, value)[source]

Substitute a parameter value into the observable expression.

pydantic model Time[source]

Bases: BaseModel

A special type of Concept that represents time.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "Time",
   "description": "A special type of Concept that represents time.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "description": "The symbol of the time variable in the model.",
         "default": "t",
         "type": "string"
      },
      "units": {
         "title": "Units",
         "description": "The units of the time variable.",
         "allOf": [
            {
               "$ref": "#/definitions/Unit"
            }
         ]
      }
   },
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      }
   }
}

Fields:
field name: str = 't'

The symbol of the time variable in the model.

field units: Optional[Unit] = None

The units of the time variable.

model_has_grounding(template_model, prefix, identifier)[source]

Return whether a model contains a given grounding in any role.

Return type:

bool

Templates (mira.metamodel.templates)

Data models for metamodel templates.

Regenerate the JSON schema by running python -m mira.metamodel.templates.

pydantic model ControlledProduction[source]

Bases: Template

Specifies a process of production controlled by one controller

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "ControlledProduction",
   "description": "Specifies a process of production controlled by one controller",
   "type": "object",
   "properties": {
      "rate_law": {
         "title": "Rate Law",
         "type": "string",
         "example": "2*x"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "type": {
         "title": "Type",
         "default": "ControlledProduction",
         "const": "ControlledProduction",
         "enum": [
            "ControlledProduction"
         ],
         "type": "string"
      },
      "controller": {
         "$ref": "#/definitions/Concept"
      },
      "outcome": {
         "$ref": "#/definitions/Concept"
      },
      "provenance": {
         "title": "Provenance",
         "type": "array",
         "items": {
            "$ref": "#/definitions/Provenance"
         }
      }
   },
   "required": [
      "controller",
      "outcome"
   ],
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      },
      "Concept": {
         "title": "Concept",
         "description": "A concept is specified by its identifier(s), name, and - optionally -\nits context.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      },
      "Provenance": {
         "title": "Provenance",
         "type": "object",
         "properties": {}
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Template.Config.<lambda> at 0x7fe103ceadc0>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Template.Config.<lambda> at 0x7fe103cead30>}

Fields:
field controller: Concept [Required]
field outcome: Concept [Required]
field provenance: List[Provenance] [Optional]
field type: Literal['ControlledProduction'] = 'ControlledProduction'
Constraints:
  • const = ControlledProduction

add_controller(controller)[source]

Add an additional controller.

Return type:

GroupedControlledProduction

get_key(config=None)[source]
with_context(do_rename=False, exclude_concepts=None, **context)[source]

Return a copy of this template with context added

Return type:

ControlledProduction

with_controller(controller)[source]

Return a copy of this template with the given controller.

Return type:

ControlledProduction

concept_keys: ClassVar[List[str]] = ['controller', 'outcome']
pydantic model ControlledDegradation[source]

Bases: Template

Specifies a process of degradation controlled by one controller

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "ControlledDegradation",
   "description": "Specifies a process of degradation controlled by one controller",
   "type": "object",
   "properties": {
      "rate_law": {
         "title": "Rate Law",
         "type": "string",
         "example": "2*x"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "type": {
         "title": "Type",
         "default": "ControlledDegradation",
         "const": "ControlledDegradation",
         "enum": [
            "ControlledDegradation"
         ],
         "type": "string"
      },
      "controller": {
         "$ref": "#/definitions/Concept"
      },
      "subject": {
         "$ref": "#/definitions/Concept"
      },
      "provenance": {
         "title": "Provenance",
         "type": "array",
         "items": {
            "$ref": "#/definitions/Provenance"
         }
      }
   },
   "required": [
      "controller",
      "subject"
   ],
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      },
      "Concept": {
         "title": "Concept",
         "description": "A concept is specified by its identifier(s), name, and - optionally -\nits context.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      },
      "Provenance": {
         "title": "Provenance",
         "type": "object",
         "properties": {}
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Template.Config.<lambda> at 0x7fe103ceadc0>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Template.Config.<lambda> at 0x7fe103cead30>}

Fields:
field controller: Concept [Required]
field provenance: List[Provenance] [Optional]
field subject: Concept [Required]
field type: Literal['ControlledDegradation'] = 'ControlledDegradation'
Constraints:
  • const = ControlledDegradation

add_controller(controller)[source]

Add an additional controller.

Return type:

GroupedControlledDegradation

get_key(config=None)[source]
with_context(do_rename=False, exclude_concepts=None, **context)[source]

Return a copy of this template with context added

Return type:

ControlledDegradation

with_controller(controller)[source]

Return a copy of this template with the given controller.

Return type:

ControlledDegradation

concept_keys: ClassVar[List[str]] = ['controller', 'subject']
pydantic model GroupedControlledProduction[source]

Bases: Template

Specifies a process of production controlled by several controllers

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "GroupedControlledProduction",
   "description": "Specifies a process of production controlled by several controllers",
   "type": "object",
   "properties": {
      "rate_law": {
         "title": "Rate Law",
         "type": "string",
         "example": "2*x"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "type": {
         "title": "Type",
         "default": "GroupedControlledProduction",
         "const": "GroupedControlledProduction",
         "enum": [
            "GroupedControlledProduction"
         ],
         "type": "string"
      },
      "controllers": {
         "title": "Controllers",
         "type": "array",
         "items": {
            "$ref": "#/definitions/Concept"
         }
      },
      "outcome": {
         "$ref": "#/definitions/Concept"
      },
      "provenance": {
         "title": "Provenance",
         "type": "array",
         "items": {
            "$ref": "#/definitions/Provenance"
         }
      }
   },
   "required": [
      "controllers",
      "outcome"
   ],
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      },
      "Concept": {
         "title": "Concept",
         "description": "A concept is specified by its identifier(s), name, and - optionally -\nits context.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      },
      "Provenance": {
         "title": "Provenance",
         "type": "object",
         "properties": {}
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Template.Config.<lambda> at 0x7fe103ceadc0>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Template.Config.<lambda> at 0x7fe103cead30>}

Fields:
field controllers: List[Concept] [Required]
field outcome: Concept [Required]
field provenance: List[Provenance] [Optional]
field type: Literal['GroupedControlledProduction'] = 'GroupedControlledProduction'
Constraints:
  • const = GroupedControlledProduction

add_controller(controller)[source]

Add an additional controller.

Return type:

GroupedControlledProduction

get_concepts()[source]

Return a list of the concepts in this template

get_key(config=None)[source]
with_context(do_rename=False, exclude_concepts=None, **context)[source]

Return a copy of this template with context added

Return type:

GroupedControlledProduction

with_controllers(controllers)[source]

Return a copy of this template with the given controllers.

Return type:

GroupedControlledProduction

concept_keys: ClassVar[List[str]] = ['controllers', 'outcome']
pydantic model GroupedControlledDegradation[source]

Bases: Template

Specifies a process of degradation controlled by several controllers

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "GroupedControlledDegradation",
   "description": "Specifies a process of degradation controlled by several controllers",
   "type": "object",
   "properties": {
      "rate_law": {
         "title": "Rate Law",
         "type": "string",
         "example": "2*x"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "type": {
         "title": "Type",
         "default": "GroupedControlledDegradation",
         "const": "GroupedControlledDegradation",
         "enum": [
            "GroupedControlledDegradation"
         ],
         "type": "string"
      },
      "controllers": {
         "title": "Controllers",
         "type": "array",
         "items": {
            "$ref": "#/definitions/Concept"
         }
      },
      "subject": {
         "$ref": "#/definitions/Concept"
      },
      "provenance": {
         "title": "Provenance",
         "type": "array",
         "items": {
            "$ref": "#/definitions/Provenance"
         }
      }
   },
   "required": [
      "controllers",
      "subject"
   ],
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      },
      "Concept": {
         "title": "Concept",
         "description": "A concept is specified by its identifier(s), name, and - optionally -\nits context.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      },
      "Provenance": {
         "title": "Provenance",
         "type": "object",
         "properties": {}
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Template.Config.<lambda> at 0x7fe103ceadc0>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Template.Config.<lambda> at 0x7fe103cead30>}

Fields:
field controllers: List[Concept] [Required]
field provenance: List[Provenance] [Optional]
field subject: Concept [Required]
field type: Literal['GroupedControlledDegradation'] = 'GroupedControlledDegradation'
Constraints:
  • const = GroupedControlledDegradation

add_controller(controller)[source]

Add an additional controller.

Return type:

GroupedControlledDegradation

get_concepts()[source]

Return a list of the concepts in this template

get_key(config=None)[source]
with_context(do_rename=False, exclude_concepts=None, **context)[source]

Return a copy of this template with context added

Return type:

GroupedControlledDegradation

with_controllers(controllers)[source]

Return a copy of this template with the given controllers.

Return type:

GroupedControlledDegradation

concept_keys: ClassVar[List[str]] = ['controllers', 'subject']
templates_equal(templ, other_templ, with_context, config)[source]

Check if two Template objects are equal

Parameters:
  • templ (Template) – A template to compare.

  • other_templ (Template) – The other template to compare.

  • with_context (bool) – If True, also check the contexts of the contained Concepts of the Template.

  • config (Config) – Configuration defining priority and exclusion for identifiers.

Return type:

bool

Returns:

True if the two Template objects are equal.

context_refinement(refined_context, other_context)[source]

Check if one Concept’s context is a refinement of another Concept’s

Parameters:
  • refined_context – The assumed more detailed context

  • other_context – The assumed less detailed context

Return type:

bool

Returns:

True if the Concept refined_concept truly is strictly more detailed than other_concept

Operations (mira.metamodel.ops)

Operations for template models.

stratify(template_model, *, key, strata, structure=None, directed=False, conversion_cls=<class 'mira.metamodel.templates.NaturalConversion'>, cartesian_control=False, modify_names=True, params_to_stratify=None, params_to_preserve=None, concepts_to_stratify=None, concepts_to_preserve=None)[source]

Multiplies a model into several strata.

E.g., can turn the SIR model into a two-city SIR model by splitting each concept into two derived concepts, each with the context for one of the two cities

Parameters:
  • template_model (TemplateModel) – A template model

  • key (str) – The (singular) name of the stratification, e.g., "city"

  • strata (Collection[str]) – A list of the values for stratification, e.g., ["boston", "nyc"]

  • structure (Optional[Iterable[Tuple[str, str]]]) – An iterable of pairs corresponding to a directed network structure where each of the pairs has two strata. If none given, will assume a complete network structure. If no structure is necessary, pass an empty list.

  • directed (bool) – Should the reverse direction conversions be added based on the given structure?

  • conversion_cls (Type[Template]) – The template class to be used for conversions between strata defined by the network structure. Defaults to NaturalConversion

  • cartesian_control (bool) –

    If true, splits all control relationships based on the stratification.

    This should be true for an SIR epidemiology model, the susceptibility to infected transition is controlled by infected. If the model is stratified by vaccinated and unvaccinated, then the transition from vaccinated susceptible population to vaccinated infected populations should be controlled by both infected vaccinated and infected unvaccinated populations.

    This should be false for stratification of an SIR epidemiology model based on cities, since the infected population in one city won’t (directly, through the perspective of the model) affect the infection of susceptible population in another city.

  • modify_names (bool) – If true, will modify the names of the concepts to include the strata (e.g., "S" becomes "S_boston"). If false, will keep the original names.

  • params_to_stratify (Optional[Collection[str]]) – A list of parameters to stratify. If none given, will stratify all parameters.

  • params_to_preserve (Optional[Collection[str]]) – A list of parameters to preserve. If none given, will stratify all parameters.

  • concepts_to_stratify (Optional[Collection[str]]) – A list of concepts to stratify. If none given, will stratify all concepts.

  • concepts_to_preserve (Optional[Collection[str]]) – A list of concepts to preserve. If none given, will stratify all concepts.

Return type:

TemplateModel

Returns:

A stratified template model

simplify_rate_laws(template_model)[source]

Return a template model after rewriting templates by simplifying rate laws.

Parameters:

template_model (TemplateModel) – A template model

Returns:

A template model with simplified rate laws.

aggregate_parameters(template_model, exclude=None)[source]

Return a template model after aggregating parameters for mass-action rate laws.

Parameters:
  • template_model – A template model whose rate laws will be aggregated.

  • exclude – A list of parameters to exclude from aggregation.

Returns:

A template model with aggregated parameters.

get_term_roles(term, template, parameters)[source]

Return terms in a rate law by role.

counts_to_dimensionless(tm, counts_unit, norm_factor)[source]

Convert all quantities using a given counts unit to dimensionless units.

Parameters:
  • tm (TemplateModel) – A template model.

  • counts_unit (str) – The unit of the counts.

  • norm_factor (float) – The normalization factor to convert counts to dimensionsionless.

Returns:

A template model with all entity concentrations converted to dimensionless units.

deactivate_templates(template_model, condition)[source]

Deactivate templates that satisfy a given condition.

Model comparison (mira.metamodel.comparison)

pydantic model ModelComparisonGraphdata[source]

Bases: BaseModel

A data structure holding a graph representation of TemplateModel delta

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "ModelComparisonGraphdata",
   "description": "A data structure holding a graph representation of TemplateModel delta",
   "type": "object",
   "properties": {
      "template_models": {
         "title": "Template Models",
         "description": "A mapping of template model keys to template models",
         "type": "object",
         "additionalProperties": {
            "$ref": "#/definitions/TemplateModel"
         }
      },
      "concept_nodes": {
         "title": "Concept Nodes",
         "description": "A mapping of model identifiers to a mapping of node identifiers to nodes. Node identifiers have the structure of 'mXnY' where X is the model id and Y is the node id within the model.",
         "type": "object",
         "additionalProperties": {
            "type": "object",
            "additionalProperties": {
               "$ref": "#/definitions/Concept"
            }
         }
      },
      "template_nodes": {
         "title": "Template Nodes",
         "description": "A mapping of model identifiers to a mapping of node identifiers to nodes. Node identifiers have the structure of 'mXnY' where X is the model id and Y is the node id within the model.",
         "type": "object",
         "additionalProperties": {
            "type": "object",
            "additionalProperties": {
               "discriminator": {
                  "propertyName": "type",
                  "mapping": {
                     "NaturalConversion": "#/definitions/NaturalConversion",
                     "ControlledConversion": "#/definitions/ControlledConversion",
                     "NaturalDegradation": "#/definitions/NaturalDegradation",
                     "ControlledDegradation": "#/definitions/ControlledDegradation",
                     "GroupedControlledDegradation": "#/definitions/GroupedControlledDegradation",
                     "NaturalProduction": "#/definitions/NaturalProduction",
                     "ControlledProduction": "#/definitions/ControlledProduction",
                     "GroupedControlledConversion": "#/definitions/GroupedControlledConversion",
                     "GroupedControlledProduction": "#/definitions/GroupedControlledProduction"
                  }
               },
               "oneOf": [
                  {
                     "$ref": "#/definitions/NaturalConversion"
                  },
                  {
                     "$ref": "#/definitions/ControlledConversion"
                  },
                  {
                     "$ref": "#/definitions/NaturalDegradation"
                  },
                  {
                     "$ref": "#/definitions/ControlledDegradation"
                  },
                  {
                     "$ref": "#/definitions/GroupedControlledDegradation"
                  },
                  {
                     "$ref": "#/definitions/NaturalProduction"
                  },
                  {
                     "$ref": "#/definitions/ControlledProduction"
                  },
                  {
                     "$ref": "#/definitions/GroupedControlledConversion"
                  },
                  {
                     "$ref": "#/definitions/GroupedControlledProduction"
                  }
               ]
            }
         }
      },
      "inter_model_edges": {
         "title": "Inter Model Edges",
         "description": "List of edges. Each edge is a tuple of(source node lookup, target node lookup, role) where role describes if the edge is a refinement of or equal to another node in another model (inter model edge). The edges are considered directed for refinements and undirected for equalities. The node lookup is a tuple of (model id, node id) that defines the lookup of the node in the nodes mapping.",
         "type": "array",
         "items": {
            "type": "array",
            "minItems": 3,
            "maxItems": 3,
            "items": [
               {
                  "type": "array",
                  "minItems": 2,
                  "maxItems": 2,
                  "items": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "integer"
                     }
                  ]
               },
               {
                  "type": "array",
                  "minItems": 2,
                  "maxItems": 2,
                  "items": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "integer"
                     }
                  ]
               },
               {
                  "type": "string"
               }
            ]
         }
      },
      "intra_model_edges": {
         "title": "Intra Model Edges",
         "description": "List of edges. Each edge is a tuple of(source node lookup, target node lookup, role) where role describes if the edge incoming to, outgoing from or controls a template/process in the same model (intra model edge). The edges are considered directed. The node lookup is a tuple of (model id, node id) that defines the lookup of the node in the nodes mapping.",
         "type": "array",
         "items": {
            "type": "array",
            "minItems": 3,
            "maxItems": 3,
            "items": [
               {
                  "type": "array",
                  "minItems": 2,
                  "maxItems": 2,
                  "items": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "integer"
                     }
                  ]
               },
               {
                  "type": "array",
                  "minItems": 2,
                  "maxItems": 2,
                  "items": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "integer"
                     }
                  ]
               },
               {
                  "type": "string"
               }
            ]
         }
      }
   },
   "required": [
      "template_models"
   ],
   "definitions": {
      "Unit": {
         "title": "Unit",
         "description": "A unit of measurement.",
         "type": "object",
         "properties": {
            "expression": {
               "title": "Expression",
               "description": "The expression for the unit.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "expression"
         ]
      },
      "Concept": {
         "title": "Concept",
         "description": "A concept is specified by its identifier(s), name, and - optionally -\nits context.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      },
      "Provenance": {
         "title": "Provenance",
         "type": "object",
         "properties": {}
      },
      "NaturalConversion": {
         "title": "NaturalConversion",
         "description": "Specifies a process of natural conversion from subject to outcome",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "NaturalConversion",
               "const": "NaturalConversion",
               "enum": [
                  "NaturalConversion"
               ],
               "type": "string"
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "subject",
            "outcome"
         ]
      },
      "ControlledConversion": {
         "title": "ControlledConversion",
         "description": "Specifies a process of controlled conversion from subject to outcome,\ncontrolled by the controller.",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "ControlledConversion",
               "const": "ControlledConversion",
               "enum": [
                  "ControlledConversion"
               ],
               "type": "string"
            },
            "controller": {
               "$ref": "#/definitions/Concept"
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controller",
            "subject",
            "outcome"
         ]
      },
      "NaturalDegradation": {
         "title": "NaturalDegradation",
         "description": "A template for the degradataion of a species at a proportional rate to its amount.",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "NaturalDegradation",
               "const": "NaturalDegradation",
               "enum": [
                  "NaturalDegradation"
               ],
               "type": "string"
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "subject"
         ]
      },
      "ControlledDegradation": {
         "title": "ControlledDegradation",
         "description": "Specifies a process of degradation controlled by one controller",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "ControlledDegradation",
               "const": "ControlledDegradation",
               "enum": [
                  "ControlledDegradation"
               ],
               "type": "string"
            },
            "controller": {
               "$ref": "#/definitions/Concept"
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controller",
            "subject"
         ]
      },
      "GroupedControlledDegradation": {
         "title": "GroupedControlledDegradation",
         "description": "Specifies a process of degradation controlled by several controllers",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "GroupedControlledDegradation",
               "const": "GroupedControlledDegradation",
               "enum": [
                  "GroupedControlledDegradation"
               ],
               "type": "string"
            },
            "controllers": {
               "title": "Controllers",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Concept"
               }
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controllers",
            "subject"
         ]
      },
      "NaturalProduction": {
         "title": "NaturalProduction",
         "description": "A template for the production of a species at a constant rate.",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "NaturalProduction",
               "const": "NaturalProduction",
               "enum": [
                  "NaturalProduction"
               ],
               "type": "string"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "outcome"
         ]
      },
      "ControlledProduction": {
         "title": "ControlledProduction",
         "description": "Specifies a process of production controlled by one controller",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "ControlledProduction",
               "const": "ControlledProduction",
               "enum": [
                  "ControlledProduction"
               ],
               "type": "string"
            },
            "controller": {
               "$ref": "#/definitions/Concept"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controller",
            "outcome"
         ]
      },
      "GroupedControlledConversion": {
         "title": "GroupedControlledConversion",
         "description": "The Template is a parent class for model processes",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "GroupedControlledConversion",
               "const": "GroupedControlledConversion",
               "enum": [
                  "GroupedControlledConversion"
               ],
               "type": "string"
            },
            "controllers": {
               "title": "Controllers",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Concept"
               }
            },
            "subject": {
               "$ref": "#/definitions/Concept"
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controllers",
            "subject",
            "outcome"
         ]
      },
      "GroupedControlledProduction": {
         "title": "GroupedControlledProduction",
         "description": "Specifies a process of production controlled by several controllers",
         "type": "object",
         "properties": {
            "rate_law": {
               "title": "Rate Law",
               "type": "string",
               "example": "2*x"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "default": "GroupedControlledProduction",
               "const": "GroupedControlledProduction",
               "enum": [
                  "GroupedControlledProduction"
               ],
               "type": "string"
            },
            "controllers": {
               "title": "Controllers",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Concept"
               }
            },
            "outcome": {
               "$ref": "#/definitions/Concept"
            },
            "provenance": {
               "title": "Provenance",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Provenance"
               }
            }
         },
         "required": [
            "controllers",
            "outcome"
         ]
      },
      "Distribution": {
         "title": "Distribution",
         "description": "A distribution of values for a parameter.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "description": "The type of distribution, e.g. 'uniform', 'normal', etc.",
               "type": "string"
            },
            "parameters": {
               "title": "Parameters",
               "description": "The parameters of the distribution.",
               "type": "object",
               "additionalProperties": {
                  "type": "number"
               }
            }
         },
         "required": [
            "type",
            "parameters"
         ]
      },
      "Parameter": {
         "title": "Parameter",
         "description": "A Parameter is a special type of Concept that carries a value.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            },
            "value": {
               "title": "Value",
               "description": "Value of the parameter.",
               "type": "number"
            },
            "distribution": {
               "title": "Distribution",
               "description": "A distribution of values for the parameter.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Distribution"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      },
      "Initial": {
         "title": "Initial",
         "description": "An initial condition.",
         "type": "object",
         "properties": {
            "concept": {
               "$ref": "#/definitions/Concept"
            },
            "value": {
               "title": "Value",
               "type": "number"
            }
         },
         "required": [
            "concept",
            "value"
         ]
      },
      "Observable": {
         "title": "Observable",
         "description": "An observable is a special type of Concept that carries an expression.\n\nObservables are used to define the readouts of a model, useful when a\nreadout is not defined as a state variable but is rather a function of\nstate variables.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the concept.",
               "type": "string"
            },
            "display_name": {
               "title": "Display Name",
               "description": "An optional display name for the concept. If not provided, the name can be used for display purposes.",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "An optional description of the concept.",
               "type": "string"
            },
            "identifiers": {
               "title": "Identifiers",
               "description": "A mapping of namespaces to identifiers.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "context": {
               "title": "Context",
               "description": "A mapping of context keys to values.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "units": {
               "title": "Units",
               "description": "The units of the concept.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            },
            "expression": {
               "title": "Expression",
               "description": "The expression for the observable.",
               "type": "string",
               "example": "2*x"
            }
         },
         "required": [
            "name",
            "expression"
         ]
      },
      "Author": {
         "title": "Author",
         "description": "A metadata model for an author.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The name of the author",
               "type": "string"
            }
         },
         "required": [
            "name"
         ]
      },
      "Annotations": {
         "title": "Annotations",
         "description": "A metadata model for model-level annotations.\n\nExamples in this metadata model are taken from\nhttps://www.ebi.ac.uk/biomodels/BIOMD0000000956,\na well-annotated SIR model in the BioModels database.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "A human-readable label for the model",
               "example": "SIR model of scenarios of COVID-19 spread in CA and NY",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "A description of the model",
               "example": "The coronavirus disease 2019 (COVID-19) pandemic has placed epidemic modeling at the forefront of worldwide public policy making. Nonetheless, modeling and forecasting the spread of COVID-19 remains a challenge. Here, we detail three regional scale models for forecasting and assessing the course of the pandemic. This work demonstrates the utility of parsimonious models for early-time data and provides an accessible framework for generating policy-relevant insights into its course. We show how these models can be connected to each other and to time series data for a particular region. Capable of measuring and forecasting the impacts of social distancing, these models highlight the dangers of relaxing nonpharmaceutical public health interventions in the absence of a vaccine or antiviral therapies.",
               "type": "string"
            },
            "license": {
               "title": "License",
               "description": "Information about the licensing of the model artifact. Ideally, given as an SPDX identifier like CC0 or CC-BY-4.0. For example, models from the BioModels databases are all licensed under the CC0 public attribution license.",
               "example": "CC0",
               "type": "string"
            },
            "authors": {
               "title": "Authors",
               "description": "A list of authors/creators of the model. This is not the same as the people who e.g., submitted the model to BioModels",
               "example": [
                  "name='Andrea L Bertozzi'",
                  "name='Elisa Franco'",
                  "name='George Mohler'",
                  "name='Martin B Short'",
                  "name='Daniel Sledge'"
               ],
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Author"
               }
            },
            "references": {
               "title": "References",
               "description": "A list of CURIEs (i.e., <prefix>:<identifier>) corresponding to literature references that describe the model. Do **not** duplicate the same publication with different CURIEs (e.g., using pubmed, pmc, and doi)",
               "example": [
                  "pubmed:32616574"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "time_scale": {
               "title": "Time Scale",
               "description": "The granularity of the time element of the model, typically on the scale of days, weeks, or months for epidemiology models",
               "example": "day",
               "type": "string"
            },
            "time_start": {
               "title": "Time Start",
               "description": "The start time of the applicability of a model, given as a datetime. When the time scale is not so granular, leave the less granular fields as default, i.e., if the time scale is on months, give dates like YYYY-MM-01 00:00",
               "type": "string",
               "format": "date-time"
            },
            "time_end": {
               "title": "Time End",
               "description": "Similar to the start time of the applicability of a model, the end time is given as a datetime. For example, the Bertozzi 2020 model is applicable between March and August 2020, so this field is annotated with August 1st, 2020.",
               "type": "string",
               "format": "date-time"
            },
            "locations": {
               "title": "Locations",
               "description": "A location or list of locations where this model is applicable, ideally annotated using a CURIEs referencing a controlled vocabulary such as GeoNames, which has multiple levels of granularity including city/state/country level terms. For example,the Bertozzi 2020 model was for New York City (geonames:5128581) and California (geonames:5332921)",
               "example": [
                  "geonames:5128581",
                  "geonames:5332921"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "pathogens": {
               "title": "Pathogens",
               "description": "The pathogens present in the model, given with CURIEs referencing vocabulary for taxa, ideally, NCBI Taxonomy. For example, the Bertozzi 2020 model is about SARS-CoV-2, this is ncbitaxon:2697049. Do not confuse this field with terms for annotating the disease caused by the pathogen. Note that some models may have multiple pathogens, for simulating double pandemics such as the interaction with SARS-CoV-2 and the seasonal flu.",
               "example": [
                  "ncbitaxon:2697049"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "diseases": {
               "title": "Diseases",
               "description": "The diseases caused by pathogens in the model, given with CURIEs referencing vocabulary for dieases, such as DOID, EFO, or MONDO. For example, the Bertozzi 2020 model is about SARS-CoV-2, which causes COVID-19. In the Human Disease Ontology (DOID), this is referenced by doid:0080600.",
               "example": [
                  "doid:0080600"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "hosts": {
               "title": "Hosts",
               "description": "The hosts present in the model, given with CURIEs referencing vocabulary for taxa, ideally, NCBI Taxonomy. For example, the Bertozzi 2020 model is about human infection by SARS-CoV-2. Therefore, the appropriate annotation for this field would be ncbitaxon:9606. Note that some models have multiple hosts, such as Malaria models that consider humans and mosquitos.",
               "example": [
                  "ncbitaxon:9606"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            },
            "model_types": {
               "title": "Model Types",
               "description": "This field describes the type(s) of the model using the Mathematical Modeling Ontology (MAMO), which has terms like 'ordinary differential equation  model', 'population model', etc. These should be annotated as CURIEs in the form of mamo:<local unique identifier>. For example, the Bertozzi 2020 model is a population model (mamo:0000028) and ordinary differential equation model (mamo:0000046)",
               "example": [
                  "mamo:0000028",
                  "mamo:0000046"
               ],
               "type": "array",
               "items": {
                  "type": "string"
               }
            }
         }
      },
      "Time": {
         "title": "Time",
         "description": "A special type of Concept that represents time.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The symbol of the time variable in the model.",
               "default": "t",
               "type": "string"
            },
            "units": {
               "title": "Units",
               "description": "The units of the time variable.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Unit"
                  }
               ]
            }
         }
      },
      "TemplateModel": {
         "title": "TemplateModel",
         "description": "A template model.",
         "type": "object",
         "properties": {
            "templates": {
               "title": "Templates",
               "description": "A list of any child class of Templates",
               "type": "array",
               "items": {
                  "discriminator": {
                     "propertyName": "type",
                     "mapping": {
                        "NaturalConversion": "#/definitions/NaturalConversion",
                        "ControlledConversion": "#/definitions/ControlledConversion",
                        "NaturalDegradation": "#/definitions/NaturalDegradation",
                        "ControlledDegradation": "#/definitions/ControlledDegradation",
                        "GroupedControlledDegradation": "#/definitions/GroupedControlledDegradation",
                        "NaturalProduction": "#/definitions/NaturalProduction",
                        "ControlledProduction": "#/definitions/ControlledProduction",
                        "GroupedControlledConversion": "#/definitions/GroupedControlledConversion",
                        "GroupedControlledProduction": "#/definitions/GroupedControlledProduction"
                     }
                  },
                  "oneOf": [
                     {
                        "$ref": "#/definitions/NaturalConversion"
                     },
                     {
                        "$ref": "#/definitions/ControlledConversion"
                     },
                     {
                        "$ref": "#/definitions/NaturalDegradation"
                     },
                     {
                        "$ref": "#/definitions/ControlledDegradation"
                     },
                     {
                        "$ref": "#/definitions/GroupedControlledDegradation"
                     },
                     {
                        "$ref": "#/definitions/NaturalProduction"
                     },
                     {
                        "$ref": "#/definitions/ControlledProduction"
                     },
                     {
                        "$ref": "#/definitions/GroupedControlledConversion"
                     },
                     {
                        "$ref": "#/definitions/GroupedControlledProduction"
                     }
                  ]
               }
            },
            "parameters": {
               "title": "Parameters",
               "description": "A dict of parameter values where keys correspond to how the parameter appears in rate laws.",
               "type": "object",
               "additionalProperties": {
                  "$ref": "#/definitions/Parameter"
               }
            },
            "initials": {
               "title": "Initials",
               "description": "A dict of initial condition values where keyscorrespond to concept names they apply to.",
               "type": "object",
               "additionalProperties": {
                  "$ref": "#/definitions/Initial"
               }
            },
            "observables": {
               "title": "Observables",
               "description": "A list of observables that are readouts from the model.",
               "type": "object",
               "additionalProperties": {
                  "$ref": "#/definitions/Observable"
               }
            },
            "annotations": {
               "title": "Annotations",
               "description": "A structure containing model-level annotations. Note that all annotations are optional.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Annotations"
                  }
               ]
            },
            "time": {
               "title": "Time",
               "description": "A structure containing time-related annotations. Note that all annotations are optional.",
               "allOf": [
                  {
                     "$ref": "#/definitions/Time"
                  }
               ]
            }
         },
         "required": [
            "templates"
         ]
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function ModelComparisonGraphdata.Config.<lambda> at 0x7fe103b6dee0>, <class ‘mira.metamodel.templates.Template’>: <function ModelComparisonGraphdata.Config.<lambda> at 0x7fe103b6df70>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function ModelComparisonGraphdata.Config.<lambda> at 0x7fe103b6de50>}

Fields:
field concept_nodes: Dict[int, Dict[int, Concept]] [Optional]

A mapping of model identifiers to a mapping of node identifiers to nodes. Node identifiers have the structure of ‘mXnY’ where X is the model id and Y is the node id within the model.

field inter_model_edges: List[Tuple[Tuple[int, int], Tuple[int, int], str]] [Optional]

List of edges. Each edge is a tuple of(source node lookup, target node lookup, role) where role describes if the edge is a refinement of or equal to another node in another model (inter model edge). The edges are considered directed for refinements and undirected for equalities. The node lookup is a tuple of (model id, node id) that defines the lookup of the node in the nodes mapping.

field intra_model_edges: List[Tuple[Tuple[int, int], Tuple[int, int], str]] [Optional]

List of edges. Each edge is a tuple of(source node lookup, target node lookup, role) where role describes if the edge incoming to, outgoing from or controls a template/process in the same model (intra model edge). The edges are considered directed. The node lookup is a tuple of (model id, node id) that defines the lookup of the node in the nodes mapping.

field template_models: Dict[int, TemplateModel] [Required]

A mapping of template model keys to template models

field template_nodes: Dict[int, Dict[int, AnnotatedAlias[Union[NaturalConversion, ControlledConversion, NaturalDegradation, ControlledDegradation, GroupedControlledDegradation, NaturalProduction, ControlledProduction, GroupedControlledConversion, GroupedControlledProduction]]]] [Optional]

A mapping of model identifiers to a mapping of node identifiers to nodes. Node identifiers have the structure of ‘mXnY’ where X is the model id and Y is the node id within the model.

classmethod from_template_models(template_models, refinement_func)[source]
Return type:

ModelComparisonGraphdata

get_similarity_score(model1_id, model2_id)[source]

Get the similarity score of the model comparison

Return type:

float

get_similarity_scores()[source]

Get the similarity scores for all model comparisons

class TemplateModelComparison(template_models, refinement_func)[source]

Bases: object

Compares TemplateModels in a graph friendly structure

compare_models()[source]

Compare TemplateModels and return a graph of the differences

class TemplateModelDelta(template_model1, template_model2, refinement_function, tag1='1', tag2='2', tag1_color='orange', tag2_color='blue', merge_color='red')[source]

Bases: object

Defines the differences between TemplateModels as a networkx graph

draw_graph(path, prog='dot', args='', format=None)[source]

Draw a pygraphviz graph of the differences using

Parameters:
  • path (str) – The path to the output file

  • prog (str) – The graphviz layout program to use, such as “dot”, “neato”, etc.

  • format (Optional[str]) – Set the file format explicitly

  • args (str) – Additional arguments to pass to the graphviz bash program as a string. Example: “args=”-Nshape=box -Edir=forward -Ecolor=red “

graph_as_json()[source]

Return the comparison graph json serializable node-link data

Return type:

Dict

classmethod for_jupyter(template_model1, template_model2, refinement_function, name='model.png', tag1='1', tag2='2', tag1_color='blue', tag2_color='green', merge_color='orange', prog='dot', args='', format=None, **kwargs)[source]

Display in jupyter

Parameters:
  • template_model1 – The first template model

  • template_model2 – The second template model

  • refinement_function – The refinement function to use

  • name – The name of the output file

  • tag1 – The tag for the first template model

  • tag2 – The tag for the second template model

  • tag1_color – The color for the first template model

  • tag2_color – The color for the second template model

  • merge_color – The color for the merged template model

  • prog (str) – The graphviz layout program to use, such as “dot”, “neato”, etc.

  • format (Optional[str]) – Set the file format explicitly

  • args (str) – Additional arguments to pass to the graphviz bash program as a string. Example: “args=”-Nshape=box -Edir=forward -Ecolor=red”

  • kwargs – Keyword arguments to pass to IPython.display.Image

class RefinementClosure(transitive_closure)[source]

Bases: object

A wrapper class for storing a transitive closure and exposing a function to check for refinement relationship.

Typical usage would involve: >>> from mira.dkg.web_client import get_transitive_closure_web >>> rc = RefinementClosure(get_transitive_closure_web()) >>> rc.is_ontological_child(‘doid:0080314’, ‘bfo:0000016’)

get_dkg_refinement_closure()[source]

Return a refinement closure from the DKG

Meta-model schema (mira.metamodel.schema)

Rebuild with python -m mira.metamodel.schema.

get_json_schema()[source]

Get the JSON schema for MIRA.

Model search (mira.metamodel.search)

find_models_with_grounding(template_models, prefix, identifier)[source]

Filter a dict of models to ones containing a given grounding in any role.

Return type:

Mapping[str, TemplateModel]

Model I/O (mira.metamodel.io)

model_from_json_file(fname)[source]

Return a TemplateModel from a JSON file.

Parameters:

fname (str or Path) – A file path.

Return type:

TemplateModel

Returns:

A TemplateModel deserialized from the JSON file.

model_to_json_file(model, fname)[source]

Dump a TemplateModel into a JSON file.

Parameters:
  • model (TemplateModel) – A template model to dump to a JSON file.

  • fname (str or Path) – A file path to dump the model into.

expression_to_mathml(expression, *args, **kwargs)[source]

Convert a sympy expression to MathML string.

Here we pay attention to not style underscores and numeric suffixes in special ways.

Return type:

str

Units (mira.metamodel.units)

pydantic model Unit[source]

Bases: BaseModel

A unit of measurement.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "Unit",
   "description": "A unit of measurement.",
   "type": "object",
   "properties": {
      "expression": {
         "title": "Expression",
         "description": "The expression for the unit.",
         "type": "string",
         "example": "2*x"
      }
   },
   "required": [
      "expression"
   ]
}

Config:
  • arbitrary_types_allowed: bool = True

  • json_decoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Unit.Config.<lambda> at 0x7fe103dbfb80>}

  • json_encoders: dict = {<class ‘mira.metamodel.utils.SympyExprStr’>: <function Unit.Config.<lambda> at 0x7fe103dbfaf0>}

Fields:
field expression: SympyExprStr [Required]

The expression for the unit.

Constraints:
  • type = string

  • example = 2*x

classmethod from_json(data)[source]
Return type:

Unit

Utilities (mira.metamodel.utils)

get_parseable_expression(s)[source]

Return an expression that can be parsed using sympy.

Return type:

str

revert_parseable_expression(s)[source]

Return an expression to its original form.

Return type:

str

safe_parse_expr(s, local_dict=None)[source]

Parse an expression that may contain lambda functions.

Return type:

Expr

class SympyExprStr(*args)[source]

Bases: Expr

sanity_check_tm(tm)[source]

Apply a short sanity check to a template model.