diff --git a/Project.toml b/Project.toml
index 6828e887..b406dd78 100644
--- a/Project.toml
+++ b/Project.toml
@@ -4,10 +4,17 @@ authors = ["SciML"]
version = "0.1.9"
[deps]
+AlgebraicPetri = "4f99eebe-17bf-4e98-b6a1-2c4f205a959b"
+Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
+CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
+DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
GlobalSensitivity = "af5da776-676b-467e-8baf-acd8249e4f0f"
+JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
+JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
+MathML = "abcecc63-2b08-419c-80c4-c63dca6fa478"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
NLopt = "76087f3c-5699-56af-9a33-bf431cd00edd"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
@@ -18,6 +25,7 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLExpectations = "afe9f18d-7609-4d0e-b7b7-af0cb72b8ea8"
+Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
[compat]
diff --git a/data/BIOMD0000000955_miranet.json b/data/BIOMD0000000955_miranet.json
new file mode 100644
index 00000000..48841389
--- /dev/null
+++ b/data/BIOMD0000000955_miranet.json
@@ -0,0 +1,523 @@
+{
+ "S": [
+ {
+ "sname": "Susceptible",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000514')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Susceptible\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}"
+ },
+ "concentration": 0.9999963
+ },
+ {
+ "sname": "Infected",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Infected\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}"
+ },
+ "concentration": 3.33333333e-06
+ },
+ {
+ "sname": "Diagnosed",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[('diagnosis', 'ncit:C15220')]",
+ "mira_concept": "{\"name\": \"Diagnosed\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}"
+ },
+ "concentration": 3.33333333e-07
+ },
+ {
+ "sname": "Ailing",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[('diagnosis', 'ncit:C113725'), ('disease_severity', 'ncit:C25269')]",
+ "mira_concept": "{\"name\": \"Ailing\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}"
+ },
+ "concentration": 1.66666666e-08
+ },
+ {
+ "sname": "Recognized",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[('diagnosis', 'ncit:C15220')]",
+ "mira_concept": "{\"name\": \"Recognized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}"
+ },
+ "concentration": 3.33333333e-08
+ },
+ {
+ "sname": "Healed",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000592')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Healed\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}"
+ },
+ "concentration": 0.0
+ },
+ {
+ "sname": "Threatened",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[('disease_severity', 'ncit:C25467')]",
+ "mira_concept": "{\"name\": \"Threatened\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25467\"}}"
+ },
+ "concentration": 0.0
+ },
+ {
+ "sname": "Extinct",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ncit:C28554')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Extinct\", \"description\": null, \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}"
+ },
+ "concentration": 0.0
+ },
+ {
+ "sname": "Cases",
+ "concentration": 0.0,
+ "sprop": {
+ "concept": "{\"name\": \"Cases\", \"mira_ids\": {\"ido\": \"0000511\"}, \"mira_context\": {\"diagnosed\": \"ncit:C113725\"}}",
+ "expression": "Diagnosed + Recognized + Threatened",
+ "mira_parameters": "{}",
+ "mira_parameter_distributions": "{}",
+ "is_observable": true
+ }
+ },
+ {
+ "sname": "Hospitalizations",
+ "concentration": 0.0,
+ "sprop": {
+ "concept": "{\"name\": \"Hospitalizations\", \"mira_ids\": {\"ido\": \"0000511\"}, \"mira_context\": {\"hospitalization\": \"ncit:C25179\"}}",
+ "expression": "Recognized + Threatened",
+ "mira_parameters": "{}",
+ "mira_parameter_distributions": "{}",
+ "is_observable": true
+ }
+ },
+ {
+ "sname": "Deaths",
+ "concentration": 0.0,
+ "sprop": {
+ "concept": "{\"name\": \"Deaths\", \"mira_ids\": {\"ncit\": \"C28554\"}, \"mira_context\": {}}",
+ "expression": "Extinct",
+ "mira_parameters": "{}",
+ "mira_parameter_distributions": "{}",
+ "is_observable": true
+ }
+ }
+ ],
+ "T": [
+ {
+ "tname": "t1",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "beta",
+ "parameter_value": 0.011,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.008799999999999999, \"maximum\": 0.0132}}",
+ "mira_template": "{\"rate_law\": \"Diagnosed*Susceptible*beta\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Diagnosed\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"subject\": {\"name\": \"Susceptible\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Diagnosed*Susceptible*beta",
+ "mira_rate_law_mathml": "DiagnosedSusceptiblebeta",
+ "mira_parameters": "{\"beta\": 0.011}",
+ "mira_parameter_distributions": "{\"beta\": {\"parameters\": {\"maximum\": 0.0132, \"minimum\": 0.008799999999999999}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.011
+ },
+ {
+ "tname": "t2",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "gamma",
+ "parameter_value": 0.456,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.3648, \"maximum\": 0.5472}}",
+ "mira_template": "{\"rate_law\": \"Ailing*Susceptible*gamma\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Ailing\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"subject\": {\"name\": \"Susceptible\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Ailing*Susceptible*gamma",
+ "mira_rate_law_mathml": "AilingSusceptiblegamma",
+ "mira_parameters": "{\"gamma\": 0.456}",
+ "mira_parameter_distributions": "{\"gamma\": {\"parameters\": {\"maximum\": 0.5472, \"minimum\": 0.3648}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.456
+ },
+ {
+ "tname": "t3",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "delta",
+ "parameter_value": 0.011,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.008799999999999999, \"maximum\": 0.0132}}",
+ "mira_template": "{\"rate_law\": \"Recognized*Susceptible*delta\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Recognized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"subject\": {\"name\": \"Susceptible\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Recognized*Susceptible*delta",
+ "mira_rate_law_mathml": "RecognizedSusceptibledelta",
+ "mira_parameters": "{\"delta\": 0.011}",
+ "mira_parameter_distributions": "{\"delta\": {\"parameters\": {\"maximum\": 0.0132, \"minimum\": 0.008799999999999999}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.011
+ },
+ {
+ "tname": "t4",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "alpha",
+ "parameter_value": 0.57,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.45599999999999996, \"maximum\": 0.6839999999999999}}",
+ "mira_template": "{\"rate_law\": \"Infected*Susceptible*alpha\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Infected\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"subject\": {\"name\": \"Susceptible\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infected*Susceptible*alpha",
+ "mira_rate_law_mathml": "InfectedSusceptiblealpha",
+ "mira_parameters": "{\"alpha\": 0.57}",
+ "mira_parameter_distributions": "{\"alpha\": {\"parameters\": {\"maximum\": 0.6839999999999999, \"minimum\": 0.45599999999999996}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.57
+ },
+ {
+ "tname": "t5",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "epsilon",
+ "parameter_value": 0.171,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.1368, \"maximum\": 0.20520000000000002}}",
+ "mira_template": "{\"rate_law\": \"Infected*epsilon\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infected\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"outcome\": {\"name\": \"Diagnosed\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"provenance\": []}",
+ "mira_rate_law": "Infected*epsilon",
+ "mira_rate_law_mathml": "Infectedepsilon",
+ "mira_parameters": "{\"epsilon\": 0.171}",
+ "mira_parameter_distributions": "{\"epsilon\": {\"parameters\": {\"maximum\": 0.20520000000000002, \"minimum\": 0.1368}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.171
+ },
+ {
+ "tname": "t6",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "zeta",
+ "parameter_value": 0.125,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.1, \"maximum\": 0.15}}",
+ "mira_template": "{\"rate_law\": \"Infected*zeta\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infected\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"outcome\": {\"name\": \"Ailing\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"provenance\": []}",
+ "mira_rate_law": "Infected*zeta",
+ "mira_rate_law_mathml": "Infectedzeta",
+ "mira_parameters": "{\"zeta\": 0.125}",
+ "mira_parameter_distributions": "{\"zeta\": {\"parameters\": {\"maximum\": 0.15, \"minimum\": 0.1}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.125
+ },
+ {
+ "tname": "t7",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "lambda",
+ "parameter_value": 0.034,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.027200000000000002, \"maximum\": 0.0408}}",
+ "mira_template": "{\"rate_law\": \"Infected*lambda\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infected\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"outcome\": {\"name\": \"Healed\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infected*lambda",
+ "mira_rate_law_mathml": "Infectedlambda",
+ "mira_parameters": "{\"lambda\": 0.034}",
+ "mira_parameter_distributions": "{\"lambda\": {\"parameters\": {\"maximum\": 0.0408, \"minimum\": 0.027200000000000002}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.034
+ },
+ {
+ "tname": "t8",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "eta",
+ "parameter_value": 0.125,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.1, \"maximum\": 0.15}}",
+ "mira_template": "{\"rate_law\": \"Diagnosed*eta\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Diagnosed\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Recognized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"provenance\": []}",
+ "mira_rate_law": "Diagnosed*eta",
+ "mira_rate_law_mathml": "Diagnosedeta",
+ "mira_parameters": "{\"eta\": 0.125}",
+ "mira_parameter_distributions": "{\"eta\": {\"parameters\": {\"maximum\": 0.15, \"minimum\": 0.1}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.125
+ },
+ {
+ "tname": "t9",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "rho",
+ "parameter_value": 0.034,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.027200000000000002, \"maximum\": 0.0408}}",
+ "mira_template": "{\"rate_law\": \"Diagnosed*rho\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Diagnosed\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Healed\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Diagnosed*rho",
+ "mira_rate_law_mathml": "Diagnosedrho",
+ "mira_parameters": "{\"rho\": 0.034}",
+ "mira_parameter_distributions": "{\"rho\": {\"parameters\": {\"maximum\": 0.0408, \"minimum\": 0.027200000000000002}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.034
+ },
+ {
+ "tname": "t10",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "theta",
+ "parameter_value": 0.371,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.2968, \"maximum\": 0.4452}}",
+ "mira_template": "{\"rate_law\": \"Ailing*theta\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Ailing\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"outcome\": {\"name\": \"Recognized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"provenance\": []}",
+ "mira_rate_law": "Ailing*theta",
+ "mira_rate_law_mathml": "Ailingtheta",
+ "mira_parameters": "{\"theta\": 0.371}",
+ "mira_parameter_distributions": "{\"theta\": {\"parameters\": {\"maximum\": 0.4452, \"minimum\": 0.2968}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.371
+ },
+ {
+ "tname": "t11",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "kappa",
+ "parameter_value": 0.017,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.013600000000000001, \"maximum\": 0.0204}}",
+ "mira_template": "{\"rate_law\": \"Ailing*kappa\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Ailing\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"outcome\": {\"name\": \"Healed\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Ailing*kappa",
+ "mira_rate_law_mathml": "Ailingkappa",
+ "mira_parameters": "{\"kappa\": 0.017}",
+ "mira_parameter_distributions": "{\"kappa\": {\"parameters\": {\"maximum\": 0.0204, \"minimum\": 0.013600000000000001}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.017
+ },
+ {
+ "tname": "t12",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "mu",
+ "parameter_value": 0.017,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.013600000000000001, \"maximum\": 0.0204}}",
+ "mira_template": "{\"rate_law\": \"Ailing*mu\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Ailing\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"outcome\": {\"name\": \"Threatened\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25467\"}}, \"provenance\": []}",
+ "mira_rate_law": "Ailing*mu",
+ "mira_rate_law_mathml": "Ailingmu",
+ "mira_parameters": "{\"mu\": 0.017}",
+ "mira_parameter_distributions": "{\"mu\": {\"parameters\": {\"maximum\": 0.0204, \"minimum\": 0.013600000000000001}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.017
+ },
+ {
+ "tname": "t13",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "nu",
+ "parameter_value": 0.027,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.0216, \"maximum\": 0.0324}}",
+ "mira_template": "{\"rate_law\": \"Recognized*nu\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Recognized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Threatened\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25467\"}}, \"provenance\": []}",
+ "mira_rate_law": "Recognized*nu",
+ "mira_rate_law_mathml": "Recognizednu",
+ "mira_parameters": "{\"nu\": 0.027}",
+ "mira_parameter_distributions": "{\"nu\": {\"parameters\": {\"maximum\": 0.0324, \"minimum\": 0.0216}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.027
+ },
+ {
+ "tname": "t14",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "xi",
+ "parameter_value": 0.017,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.013600000000000001, \"maximum\": 0.0204}}",
+ "mira_template": "{\"rate_law\": \"Recognized*xi\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Recognized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Healed\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Recognized*xi",
+ "mira_rate_law_mathml": "Recognizedxi",
+ "mira_parameters": "{\"xi\": 0.017}",
+ "mira_parameter_distributions": "{\"xi\": {\"parameters\": {\"maximum\": 0.0204, \"minimum\": 0.013600000000000001}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.017
+ },
+ {
+ "tname": "t15",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "tau",
+ "parameter_value": 0.01,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.008, \"maximum\": 0.012}}",
+ "mira_template": "{\"rate_law\": \"Threatened*tau\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Threatened\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25467\"}}, \"outcome\": {\"name\": \"Extinct\", \"description\": null, \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Threatened*tau",
+ "mira_rate_law_mathml": "Threatenedtau",
+ "mira_parameters": "{\"tau\": 0.01}",
+ "mira_parameter_distributions": "{\"tau\": {\"parameters\": {\"maximum\": 0.012, \"minimum\": 0.008}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.01
+ },
+ {
+ "tname": "t16",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "sigma",
+ "parameter_value": 0.017,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.013600000000000001, \"maximum\": 0.0204}}",
+ "mira_template": "{\"rate_law\": \"Threatened*sigma\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Threatened\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25467\"}}, \"outcome\": {\"name\": \"Healed\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Threatened*sigma",
+ "mira_rate_law_mathml": "Threatenedsigma",
+ "mira_parameters": "{\"sigma\": 0.017}",
+ "mira_parameter_distributions": "{\"sigma\": {\"parameters\": {\"maximum\": 0.0204, \"minimum\": 0.013600000000000001}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.017
+ }
+ ],
+ "I": [
+ {
+ "is": 3,
+ "it": 1
+ },
+ {
+ "is": 1,
+ "it": 1
+ },
+ {
+ "is": 4,
+ "it": 2
+ },
+ {
+ "is": 1,
+ "it": 2
+ },
+ {
+ "is": 5,
+ "it": 3
+ },
+ {
+ "is": 1,
+ "it": 3
+ },
+ {
+ "is": 2,
+ "it": 4
+ },
+ {
+ "is": 1,
+ "it": 4
+ },
+ {
+ "is": 2,
+ "it": 5
+ },
+ {
+ "is": 2,
+ "it": 6
+ },
+ {
+ "is": 2,
+ "it": 7
+ },
+ {
+ "is": 3,
+ "it": 8
+ },
+ {
+ "is": 3,
+ "it": 9
+ },
+ {
+ "is": 4,
+ "it": 10
+ },
+ {
+ "is": 4,
+ "it": 11
+ },
+ {
+ "is": 4,
+ "it": 12
+ },
+ {
+ "is": 5,
+ "it": 13
+ },
+ {
+ "is": 5,
+ "it": 14
+ },
+ {
+ "is": 7,
+ "it": 15
+ },
+ {
+ "is": 7,
+ "it": 16
+ }
+ ],
+ "O": [
+ {
+ "os": 3,
+ "ot": 1
+ },
+ {
+ "os": 2,
+ "ot": 1
+ },
+ {
+ "os": 4,
+ "ot": 2
+ },
+ {
+ "os": 2,
+ "ot": 2
+ },
+ {
+ "os": 5,
+ "ot": 3
+ },
+ {
+ "os": 2,
+ "ot": 3
+ },
+ {
+ "os": 2,
+ "ot": 4
+ },
+ {
+ "os": 2,
+ "ot": 4
+ },
+ {
+ "os": 3,
+ "ot": 5
+ },
+ {
+ "os": 4,
+ "ot": 6
+ },
+ {
+ "os": 6,
+ "ot": 7
+ },
+ {
+ "os": 5,
+ "ot": 8
+ },
+ {
+ "os": 6,
+ "ot": 9
+ },
+ {
+ "os": 5,
+ "ot": 10
+ },
+ {
+ "os": 6,
+ "ot": 11
+ },
+ {
+ "os": 7,
+ "ot": 12
+ },
+ {
+ "os": 7,
+ "ot": 13
+ },
+ {
+ "os": 6,
+ "ot": 14
+ },
+ {
+ "os": 8,
+ "ot": 15
+ },
+ {
+ "os": 6,
+ "ot": 16
+ }
+ ]
+}
\ No newline at end of file
diff --git a/data/BIOMD0000000960_miranet.json b/data/BIOMD0000000960_miranet.json
new file mode 100644
index 00000000..d0bfd5aa
--- /dev/null
+++ b/data/BIOMD0000000960_miranet.json
@@ -0,0 +1,413 @@
+{
+ "S": [
+ {
+ "sname": "Susceptible",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000514')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Susceptible\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}"
+ },
+ "concentration": 9900000.0
+ },
+ {
+ "sname": "Exposed",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'apollosv:00000154')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}"
+ },
+ "concentration": 36600.0
+ },
+ {
+ "sname": "Infectious",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[('disease_severity', 'ncit:C25269'), ('hospitalization', 'ncit:C68851')]",
+ "mira_concept": "{\"name\": \"Infectious\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"hospitalization\": \"ncit:C68851\"}}"
+ },
+ "concentration": 732.0
+ },
+ {
+ "sname": "Asymptomatic",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[('disease_severity', 'ncit:C3833'), ('hospitalization', 'ncit:C68851')]",
+ "mira_concept": "{\"name\": \"Asymptomatic\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C3833\", \"hospitalization\": \"ncit:C68851\"}}"
+ },
+ "concentration": 2196.0
+ },
+ {
+ "sname": "Hospitalized",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[('disease_severity', 'ncit:C25269'), ('hospitalization', 'ncit:C25179')]",
+ "mira_concept": "{\"name\": \"Hospitalized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"hospitalization\": \"ncit:C25179\", \"disease_severity\": \"ncit:C25269\"}}"
+ },
+ "concentration": 0.0
+ },
+ {
+ "sname": "Recovered",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000592')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Recovered\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}"
+ },
+ "concentration": 0.0
+ },
+ {
+ "sname": "Deceased",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ncit:C28554')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Deceased\", \"description\": null, \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}"
+ },
+ "concentration": 0.0
+ },
+ {
+ "sname": "Cases",
+ "concentration": 0.0,
+ "sprop": {
+ "concept": "{\"name\": \"Cases\", \"mira_ids\": {\"ido\": \"0000511\"}, \"mira_context\": {\"diagnosed\": \"ncit:C113725\"}}",
+ "expression": "Infectious",
+ "mira_parameters": "{}",
+ "mira_parameter_distributions": "{}",
+ "is_observable": true
+ }
+ },
+ {
+ "sname": "Hospitalizations",
+ "concentration": 0.0,
+ "sprop": {
+ "concept": "{\"name\": \"Hospitalizations\", \"mira_ids\": {\"ido\": \"0000511\"}, \"mira_context\": {\"hospitalization\": \"ncit:C25179\"}}",
+ "expression": "Hospitalized",
+ "mira_parameters": "{}",
+ "mira_parameter_distributions": "{}",
+ "is_observable": true
+ }
+ },
+ {
+ "sname": "Deaths",
+ "concentration": 0.0,
+ "sprop": {
+ "concept": "{\"name\": \"Deaths\", \"mira_ids\": {\"ncit\": \"C28554\"}, \"mira_context\": {}}",
+ "expression": "Deceased",
+ "mira_parameters": "{}",
+ "mira_parameter_distributions": "{}",
+ "is_observable": true
+ }
+ }
+ ],
+ "T": [
+ {
+ "tname": "t1",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "p_petri_1",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Infectious*Susceptible*beta_1_USA/Total_pop_USA\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Infectious\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"hospitalization\": \"ncit:C68851\"}}, \"subject\": {\"name\": \"Susceptible\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infectious*Susceptible*beta_1_USA/Total_pop_USA",
+ "mira_rate_law_mathml": "InfectiousSusceptiblebeta_1_USATotal_pop_USA",
+ "mira_parameters": "{\"Total_pop_USA\": 328200000.0, \"beta_1_USA\": 0.303}",
+ "mira_parameter_distributions": "{\"Total_pop_USA\": {\"parameters\": {\"maximum\": 393840000.0, \"minimum\": 262560000.0}, \"type\": \"StandardUniform1\"}, \"beta_1_USA\": {\"parameters\": {\"maximum\": 0.3636, \"minimum\": 0.2424}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t2",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "p_petri_2",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Asymptomatic*Susceptible*beta_1_USA*l_a_1_USA/Total_pop_USA\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Asymptomatic\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C3833\", \"hospitalization\": \"ncit:C68851\"}}, \"subject\": {\"name\": \"Susceptible\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Asymptomatic*Susceptible*beta_1_USA*l_a_1_USA/Total_pop_USA",
+ "mira_rate_law_mathml": "AsymptomaticSusceptiblebeta_1_USAl_a_1_USATotal_pop_USA",
+ "mira_parameters": "{\"Total_pop_USA\": 328200000.0, \"beta_1_USA\": 0.303, \"l_a_1_USA\": 4.09}",
+ "mira_parameter_distributions": "{\"Total_pop_USA\": {\"parameters\": {\"maximum\": 393840000.0, \"minimum\": 262560000.0}, \"type\": \"StandardUniform1\"}, \"beta_1_USA\": {\"parameters\": {\"maximum\": 0.3636, \"minimum\": 0.2424}, \"type\": \"StandardUniform1\"}, \"l_a_1_USA\": {\"parameters\": {\"maximum\": 4.9079999999999995, \"minimum\": 3.272}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t3",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "p_petri_3",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Hospitalized*Susceptible*beta_1_USA*l_1_USA/Total_pop_USA\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Hospitalized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"hospitalization\": \"ncit:C25179\", \"disease_severity\": \"ncit:C25269\"}}, \"subject\": {\"name\": \"Susceptible\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Hospitalized*Susceptible*beta_1_USA*l_1_USA/Total_pop_USA",
+ "mira_rate_law_mathml": "HospitalizedSusceptiblebeta_1_USAl_1_USATotal_pop_USA",
+ "mira_parameters": "{\"Total_pop_USA\": 328200000.0, \"beta_1_USA\": 0.303, \"l_1_USA\": 0.851}",
+ "mira_parameter_distributions": "{\"Total_pop_USA\": {\"parameters\": {\"maximum\": 393840000.0, \"minimum\": 262560000.0}, \"type\": \"StandardUniform1\"}, \"beta_1_USA\": {\"parameters\": {\"maximum\": 0.3636, \"minimum\": 0.2424}, \"type\": \"StandardUniform1\"}, \"l_1_USA\": {\"parameters\": {\"maximum\": 1.0211999999999999, \"minimum\": 0.6808}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t4",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "p_petri_4",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Exposed*kappa*rho\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infectious\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"hospitalization\": \"ncit:C68851\"}}, \"provenance\": []}",
+ "mira_rate_law": "Exposed*kappa*rho",
+ "mira_rate_law_mathml": "Exposedkapparho",
+ "mira_parameters": "{\"kappa\": 0.44, \"rho\": 0.053}",
+ "mira_parameter_distributions": "{\"kappa\": {\"parameters\": {\"maximum\": 0.528, \"minimum\": 0.352}, \"type\": \"StandardUniform1\"}, \"rho\": {\"parameters\": {\"maximum\": 0.0636, \"minimum\": 0.0424}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t5",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "p_petri_5",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Exposed*kappa*(1 - rho)\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}, \"outcome\": {\"name\": \"Asymptomatic\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C3833\", \"hospitalization\": \"ncit:C68851\"}}, \"provenance\": []}",
+ "mira_rate_law": "Exposed*kappa*(1 - rho)",
+ "mira_rate_law_mathml": "Exposedkappa1rho",
+ "mira_parameters": "{\"kappa\": 0.44, \"rho\": 0.053}",
+ "mira_parameter_distributions": "{\"kappa\": {\"parameters\": {\"maximum\": 0.528, \"minimum\": 0.352}, \"type\": \"StandardUniform1\"}, \"rho\": {\"parameters\": {\"maximum\": 0.0636, \"minimum\": 0.0424}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t6",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "gamma_a_USA",
+ "parameter_value": 0.055,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.044, \"maximum\": 0.066}}",
+ "mira_template": "{\"rate_law\": \"Infectious*gamma_a_USA\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infectious\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"hospitalization\": \"ncit:C68851\"}}, \"outcome\": {\"name\": \"Hospitalized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"hospitalization\": \"ncit:C25179\", \"disease_severity\": \"ncit:C25269\"}}, \"provenance\": []}",
+ "mira_rate_law": "Infectious*gamma_a_USA",
+ "mira_rate_law_mathml": "Infectiousgamma_a_USA",
+ "mira_parameters": "{\"gamma_a_USA\": 0.055}",
+ "mira_parameter_distributions": "{\"gamma_a_USA\": {\"parameters\": {\"maximum\": 0.066, \"minimum\": 0.044}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.055
+ },
+ {
+ "tname": "t7",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "gamma_i_USA",
+ "parameter_value": 0.296,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.23679999999999998, \"maximum\": 0.35519999999999996}}",
+ "mira_template": "{\"rate_law\": \"Infectious*gamma_i_USA\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infectious\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"hospitalization\": \"ncit:C68851\"}}, \"outcome\": {\"name\": \"Recovered\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infectious*gamma_i_USA",
+ "mira_rate_law_mathml": "Infectiousgamma_i_USA",
+ "mira_parameters": "{\"gamma_i_USA\": 0.296}",
+ "mira_parameter_distributions": "{\"gamma_i_USA\": {\"parameters\": {\"maximum\": 0.35519999999999996, \"minimum\": 0.23679999999999998}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.296
+ },
+ {
+ "tname": "t8",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "delta_I_USA",
+ "parameter_value": 0.023,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.0184, \"maximum\": 0.0276}}",
+ "mira_template": "{\"rate_law\": \"Infectious*delta_I_USA\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infectious\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"hospitalization\": \"ncit:C68851\"}}, \"outcome\": {\"name\": \"Deceased\", \"description\": null, \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infectious*delta_I_USA",
+ "mira_rate_law_mathml": "Infectiousdelta_I_USA",
+ "mira_parameters": "{\"delta_I_USA\": 0.023}",
+ "mira_parameter_distributions": "{\"delta_I_USA\": {\"parameters\": {\"maximum\": 0.0276, \"minimum\": 0.0184}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.023
+ },
+ {
+ "tname": "t9",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "p_petri_9",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Asymptomatic*mu*(1 - delta_A)\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Asymptomatic\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C3833\", \"hospitalization\": \"ncit:C68851\"}}, \"outcome\": {\"name\": \"Recovered\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Asymptomatic*mu*(1 - delta_A)",
+ "mira_rate_law_mathml": "Asymptomaticmu1delta_A",
+ "mira_parameters": "{\"delta_A\": 0.0, \"mu\": 1.64}",
+ "mira_parameter_distributions": "{\"delta_A\": null, \"mu\": {\"parameters\": {\"maximum\": 1.968, \"minimum\": 1.3119999999999998}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t10",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "p_petri_10",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Asymptomatic*delta_A*mu\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Asymptomatic\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C3833\", \"hospitalization\": \"ncit:C68851\"}}, \"outcome\": {\"name\": \"Deceased\", \"description\": null, \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Asymptomatic*delta_A*mu",
+ "mira_rate_law_mathml": "Asymptomaticdelta_Amu",
+ "mira_parameters": "{\"delta_A\": 0.0, \"mu\": 1.64}",
+ "mira_parameter_distributions": "{\"delta_A\": null, \"mu\": {\"parameters\": {\"maximum\": 1.968, \"minimum\": 1.3119999999999998}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t11",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "delta_H_USA",
+ "parameter_value": 0.00029,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.000232, \"maximum\": 0.000348}}",
+ "mira_template": "{\"rate_law\": \"Hospitalized*delta_H_USA\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Hospitalized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"hospitalization\": \"ncit:C25179\", \"disease_severity\": \"ncit:C25269\"}}, \"outcome\": {\"name\": \"Deceased\", \"description\": null, \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Hospitalized*delta_H_USA",
+ "mira_rate_law_mathml": "Hospitalizeddelta_H_USA",
+ "mira_parameters": "{\"delta_H_USA\": 0.00029}",
+ "mira_parameter_distributions": "{\"delta_H_USA\": {\"parameters\": {\"maximum\": 0.000348, \"minimum\": 0.000232}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.00029
+ },
+ {
+ "tname": "t12",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "gamma_r_USA",
+ "parameter_value": 0.018,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.0144, \"maximum\": 0.021599999999999998}}",
+ "mira_template": "{\"rate_law\": \"Hospitalized*gamma_r_USA\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Hospitalized\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"hospitalization\": \"ncit:C25179\", \"disease_severity\": \"ncit:C25269\"}}, \"outcome\": {\"name\": \"Recovered\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Hospitalized*gamma_r_USA",
+ "mira_rate_law_mathml": "Hospitalizedgamma_r_USA",
+ "mira_parameters": "{\"gamma_r_USA\": 0.018}",
+ "mira_parameter_distributions": "{\"gamma_r_USA\": {\"parameters\": {\"maximum\": 0.021599999999999998, \"minimum\": 0.0144}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.018
+ }
+ ],
+ "I": [
+ {
+ "is": 3,
+ "it": 1
+ },
+ {
+ "is": 1,
+ "it": 1
+ },
+ {
+ "is": 4,
+ "it": 2
+ },
+ {
+ "is": 1,
+ "it": 2
+ },
+ {
+ "is": 5,
+ "it": 3
+ },
+ {
+ "is": 1,
+ "it": 3
+ },
+ {
+ "is": 2,
+ "it": 4
+ },
+ {
+ "is": 2,
+ "it": 5
+ },
+ {
+ "is": 3,
+ "it": 6
+ },
+ {
+ "is": 3,
+ "it": 7
+ },
+ {
+ "is": 3,
+ "it": 8
+ },
+ {
+ "is": 4,
+ "it": 9
+ },
+ {
+ "is": 4,
+ "it": 10
+ },
+ {
+ "is": 5,
+ "it": 11
+ },
+ {
+ "is": 5,
+ "it": 12
+ }
+ ],
+ "O": [
+ {
+ "os": 3,
+ "ot": 1
+ },
+ {
+ "os": 2,
+ "ot": 1
+ },
+ {
+ "os": 4,
+ "ot": 2
+ },
+ {
+ "os": 2,
+ "ot": 2
+ },
+ {
+ "os": 5,
+ "ot": 3
+ },
+ {
+ "os": 2,
+ "ot": 3
+ },
+ {
+ "os": 3,
+ "ot": 4
+ },
+ {
+ "os": 4,
+ "ot": 5
+ },
+ {
+ "os": 5,
+ "ot": 6
+ },
+ {
+ "os": 6,
+ "ot": 7
+ },
+ {
+ "os": 7,
+ "ot": 8
+ },
+ {
+ "os": 6,
+ "ot": 9
+ },
+ {
+ "os": 7,
+ "ot": 10
+ },
+ {
+ "os": 7,
+ "ot": 11
+ },
+ {
+ "os": 6,
+ "ot": 12
+ }
+ ]
+}
\ No newline at end of file
diff --git a/data/BIOMD0000000983_miranet.json b/data/BIOMD0000000983_miranet.json
new file mode 100644
index 00000000..a73e3b54
--- /dev/null
+++ b/data/BIOMD0000000983_miranet.json
@@ -0,0 +1,398 @@
+{
+ "S": [
+ {
+ "sname": "Susceptible_unconfined",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000514')]",
+ "mira_context": "[('quarantined', 'ncit:C68851')]",
+ "mira_concept": "{\"name\": \"Susceptible_unconfined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C68851\"}}"
+ },
+ "concentration": 66990000.0
+ },
+ {
+ "sname": "Exposed",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'apollosv:00000154')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}"
+ },
+ "concentration": 112.0
+ },
+ {
+ "sname": "Infected_reported",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[('diagnosis', 'ncit:C15220')]",
+ "mira_concept": "{\"name\": \"Infected_reported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}"
+ },
+ "concentration": 12.0
+ },
+ {
+ "sname": "Infected_unreported",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000511')]",
+ "mira_context": "[('diagnosed', 'ncit:C113725')]",
+ "mira_concept": "{\"name\": \"Infected_unreported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosed\": \"ncit:C113725\"}}"
+ },
+ "concentration": 50.0
+ },
+ {
+ "sname": "Quarantined",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000514')]",
+ "mira_context": "[('quarantined', 'ncit:C71902')]",
+ "mira_concept": "{\"name\": \"Quarantined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C71902\"}}"
+ },
+ "concentration": 36.0
+ },
+ {
+ "sname": "Recovered",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ido:0000592')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Recovered\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}"
+ },
+ "concentration": 0.0
+ },
+ {
+ "sname": "Deceased",
+ "sprop": {
+ "is_observable": false,
+ "mira_ids": "[('identity', 'ncit:C28554')]",
+ "mira_context": "[]",
+ "mira_concept": "{\"name\": \"Deceased\", \"description\": null, \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}"
+ },
+ "concentration": 0.0
+ },
+ {
+ "sname": "Cases",
+ "concentration": 0.0,
+ "sprop": {
+ "concept": "{\"name\": \"Cases\", \"mira_ids\": {\"ido\": \"0000511\"}, \"mira_context\": {\"diagnosed\": \"ncit:C113725\"}}",
+ "expression": "Infected_reported",
+ "mira_parameters": "{}",
+ "mira_parameter_distributions": "{}",
+ "is_observable": true
+ }
+ },
+ {
+ "sname": "Hospitalizations",
+ "concentration": 0.0,
+ "sprop": {
+ "concept": "{\"name\": \"Hospitalizations\", \"mira_ids\": {\"ido\": \"0000511\"}, \"mira_context\": {\"hospitalization\": \"ncit:C25179\"}}",
+ "expression": "Infected_reported*h",
+ "mira_parameters": "{\"h\": 0.05}",
+ "mira_parameter_distributions": "{\"h\": {\"parameters\": {\"maximum\": 0.060000000000000005, \"minimum\": 0.04}, \"type\": \"StandardUniform1\"}}",
+ "is_observable": true
+ }
+ },
+ {
+ "sname": "Deaths",
+ "concentration": 0.0,
+ "sprop": {
+ "concept": "{\"name\": \"Deaths\", \"mira_ids\": {\"ncit\": \"C28554\"}, \"mira_context\": {}}",
+ "expression": "Deceased",
+ "mira_parameters": "{}",
+ "mira_parameter_distributions": "{}",
+ "is_observable": true
+ }
+ }
+ ],
+ "T": [
+ {
+ "tname": "t1",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "p_petri_1",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Infected_reported*Susceptible_unconfined*beta*n*(1.0 - sigma)\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Infected_reported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"subject\": {\"name\": \"Susceptible_unconfined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C68851\"}}, \"outcome\": {\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infected_reported*Susceptible_unconfined*beta*n*(1.0 - sigma)",
+ "mira_rate_law_mathml": "Infected_reportedSusceptible_unconfinedbetan1.0sigma",
+ "mira_parameters": "{\"beta\": 2.115e-08, \"n\": 0.5, \"sigma\": 0.2}",
+ "mira_parameter_distributions": "{\"beta\": {\"parameters\": {\"maximum\": 2.538e-08, \"minimum\": 1.6920000000000002e-08}, \"type\": \"StandardUniform1\"}, \"n\": {\"parameters\": {\"maximum\": 0.6, \"minimum\": 0.4}, \"type\": \"StandardUniform1\"}, \"sigma\": {\"parameters\": {\"maximum\": 0.24000000000000002, \"minimum\": 0.16}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t2",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "p_petri_2",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Infected_unreported*Susceptible_unconfined*beta*(1.0 - sigma)\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Infected_unreported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosed\": \"ncit:C113725\"}}, \"subject\": {\"name\": \"Susceptible_unconfined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C68851\"}}, \"outcome\": {\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infected_unreported*Susceptible_unconfined*beta*(1.0 - sigma)",
+ "mira_rate_law_mathml": "Infected_unreportedSusceptible_unconfinedbeta1.0sigma",
+ "mira_parameters": "{\"beta\": 2.115e-08, \"sigma\": 0.2}",
+ "mira_parameter_distributions": "{\"beta\": {\"parameters\": {\"maximum\": 2.538e-08, \"minimum\": 1.6920000000000002e-08}, \"type\": \"StandardUniform1\"}, \"sigma\": {\"parameters\": {\"maximum\": 0.24000000000000002, \"minimum\": 0.16}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t3",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "p_petri_3",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Infected_reported*Susceptible_unconfined*beta*n*sigma\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Infected_reported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"subject\": {\"name\": \"Susceptible_unconfined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C68851\"}}, \"outcome\": {\"name\": \"Quarantined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C71902\"}}, \"provenance\": []}",
+ "mira_rate_law": "Infected_reported*Susceptible_unconfined*beta*n*sigma",
+ "mira_rate_law_mathml": "Infected_reportedSusceptible_unconfinedbetansigma",
+ "mira_parameters": "{\"beta\": 2.115e-08, \"n\": 0.5, \"sigma\": 0.2}",
+ "mira_parameter_distributions": "{\"beta\": {\"parameters\": {\"maximum\": 2.538e-08, \"minimum\": 1.6920000000000002e-08}, \"type\": \"StandardUniform1\"}, \"n\": {\"parameters\": {\"maximum\": 0.6, \"minimum\": 0.4}, \"type\": \"StandardUniform1\"}, \"sigma\": {\"parameters\": {\"maximum\": 0.24000000000000002, \"minimum\": 0.16}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t4",
+ "tprop": {
+ "template_type": "ControlledConversion",
+ "parameter_name": "p_petri_4",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Infected_unreported*Susceptible_unconfined*beta*sigma\", \"type\": \"ControlledConversion\", \"controller\": {\"name\": \"Infected_unreported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosed\": \"ncit:C113725\"}}, \"subject\": {\"name\": \"Susceptible_unconfined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C68851\"}}, \"outcome\": {\"name\": \"Quarantined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C71902\"}}, \"provenance\": []}",
+ "mira_rate_law": "Infected_unreported*Susceptible_unconfined*beta*sigma",
+ "mira_rate_law_mathml": "Infected_unreportedSusceptible_unconfinedbetasigma",
+ "mira_parameters": "{\"beta\": 2.115e-08, \"sigma\": 0.2}",
+ "mira_parameter_distributions": "{\"beta\": {\"parameters\": {\"maximum\": 2.538e-08, \"minimum\": 1.6920000000000002e-08}, \"type\": \"StandardUniform1\"}, \"sigma\": {\"parameters\": {\"maximum\": 0.24000000000000002, \"minimum\": 0.16}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t5",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "p_petri_5",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Quarantined*lambda*theta\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Quarantined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C71902\"}}, \"outcome\": {\"name\": \"Infected_reported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"provenance\": []}",
+ "mira_rate_law": "Quarantined*lambda*theta",
+ "mira_rate_law_mathml": "Quarantinedlambdatheta",
+ "mira_parameters": "{\"lambda\": 0.3, \"theta\": 0.07142857}",
+ "mira_parameter_distributions": "{\"lambda\": {\"parameters\": {\"maximum\": 0.36, \"minimum\": 0.24}, \"type\": \"StandardUniform1\"}, \"theta\": {\"parameters\": {\"maximum\": 0.085714284, \"minimum\": 0.057142856}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t6",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "p_petri_6",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Exposed*f*mu\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected_reported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"provenance\": []}",
+ "mira_rate_law": "Exposed*f*mu",
+ "mira_rate_law_mathml": "Exposedfmu",
+ "mira_parameters": "{\"f\": 0.2, \"mu\": 0.2}",
+ "mira_parameter_distributions": "{\"f\": {\"parameters\": {\"maximum\": 0.24000000000000002, \"minimum\": 0.16}, \"type\": \"StandardUniform1\"}, \"mu\": {\"parameters\": {\"maximum\": 0.24000000000000002, \"minimum\": 0.16}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t7",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "p_petri_7",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Exposed*mu*(1.0 - f)\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Exposed\", \"description\": null, \"identifiers\": {\"apollosv\": \"00000154\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected_unreported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosed\": \"ncit:C113725\"}}, \"provenance\": []}",
+ "mira_rate_law": "Exposed*mu*(1.0 - f)",
+ "mira_rate_law_mathml": "Exposedmu1.0f",
+ "mira_parameters": "{\"f\": 0.2, \"mu\": 0.2}",
+ "mira_parameter_distributions": "{\"f\": {\"parameters\": {\"maximum\": 0.24000000000000002, \"minimum\": 0.16}, \"type\": \"StandardUniform1\"}, \"mu\": {\"parameters\": {\"maximum\": 0.24000000000000002, \"minimum\": 0.16}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t8",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "eta_r",
+ "parameter_value": 0.1,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.08, \"maximum\": 0.12000000000000001}}",
+ "mira_template": "{\"rate_law\": \"Infected_reported*eta_r\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infected_reported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Recovered\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infected_reported*eta_r",
+ "mira_rate_law_mathml": "Infected_reportedeta_r",
+ "mira_parameters": "{\"eta_r\": 0.1}",
+ "mira_parameter_distributions": "{\"eta_r\": {\"parameters\": {\"maximum\": 0.12000000000000001, \"minimum\": 0.08}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.1
+ },
+ {
+ "tname": "t9",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "eta_u",
+ "parameter_value": 0.25,
+ "parameter_distribution": "{\"type\": \"StandardUniform1\", \"parameters\": {\"minimum\": 0.2, \"maximum\": 0.3}}",
+ "mira_template": "{\"rate_law\": \"Infected_unreported*eta_u\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infected_unreported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosed\": \"ncit:C113725\"}}, \"outcome\": {\"name\": \"Recovered\", \"description\": null, \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infected_unreported*eta_u",
+ "mira_rate_law_mathml": "Infected_unreportedeta_u",
+ "mira_parameters": "{\"eta_u\": 0.25}",
+ "mira_parameter_distributions": "{\"eta_u\": {\"parameters\": {\"maximum\": 0.3, \"minimum\": 0.2}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": 0.25
+ },
+ {
+ "tname": "t10",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "p_petri_10",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Quarantined*theta*(1.0 - lambda)\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Quarantined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C71902\"}}, \"outcome\": {\"name\": \"Susceptible_unconfined\", \"description\": null, \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {\"quarantined\": \"ncit:C68851\"}}, \"provenance\": []}",
+ "mira_rate_law": "Quarantined*theta*(1.0 - lambda)",
+ "mira_rate_law_mathml": "Quarantinedtheta1.0lambda",
+ "mira_parameters": "{\"lambda\": 0.3, \"theta\": 0.07142857}",
+ "mira_parameter_distributions": "{\"lambda\": {\"parameters\": {\"maximum\": 0.36, \"minimum\": 0.24}, \"type\": \"StandardUniform1\"}, \"theta\": {\"parameters\": {\"maximum\": 0.085714284, \"minimum\": 0.057142856}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ },
+ {
+ "tname": "t11",
+ "tprop": {
+ "template_type": "NaturalConversion",
+ "parameter_name": "p_petri_11",
+ "parameter_value": null,
+ "parameter_distribution": null,
+ "mira_template": "{\"rate_law\": \"Infected_reported*eta_r*(1 - q)\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infected_reported\", \"description\": null, \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Deceased\", \"description\": null, \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}, \"provenance\": []}",
+ "mira_rate_law": "Infected_reported*eta_r*(1 - q)",
+ "mira_rate_law_mathml": "Infected_reportedeta_r1q",
+ "mira_parameters": "{\"eta_r\": 0.1, \"q\": 0.83}",
+ "mira_parameter_distributions": "{\"eta_r\": {\"parameters\": {\"maximum\": 0.12000000000000001, \"minimum\": 0.08}, \"type\": \"StandardUniform1\"}, \"q\": {\"parameters\": {\"maximum\": 0.996, \"minimum\": 0.6639999999999999}, \"type\": \"StandardUniform1\"}}"
+ },
+ "rate": null
+ }
+ ],
+ "I": [
+ {
+ "is": 3,
+ "it": 1
+ },
+ {
+ "is": 1,
+ "it": 1
+ },
+ {
+ "is": 4,
+ "it": 2
+ },
+ {
+ "is": 1,
+ "it": 2
+ },
+ {
+ "is": 3,
+ "it": 3
+ },
+ {
+ "is": 1,
+ "it": 3
+ },
+ {
+ "is": 4,
+ "it": 4
+ },
+ {
+ "is": 1,
+ "it": 4
+ },
+ {
+ "is": 5,
+ "it": 5
+ },
+ {
+ "is": 2,
+ "it": 6
+ },
+ {
+ "is": 2,
+ "it": 7
+ },
+ {
+ "is": 3,
+ "it": 8
+ },
+ {
+ "is": 4,
+ "it": 9
+ },
+ {
+ "is": 5,
+ "it": 10
+ },
+ {
+ "is": 3,
+ "it": 11
+ }
+ ],
+ "O": [
+ {
+ "os": 3,
+ "ot": 1
+ },
+ {
+ "os": 2,
+ "ot": 1
+ },
+ {
+ "os": 4,
+ "ot": 2
+ },
+ {
+ "os": 2,
+ "ot": 2
+ },
+ {
+ "os": 3,
+ "ot": 3
+ },
+ {
+ "os": 5,
+ "ot": 3
+ },
+ {
+ "os": 4,
+ "ot": 4
+ },
+ {
+ "os": 5,
+ "ot": 4
+ },
+ {
+ "os": 3,
+ "ot": 5
+ },
+ {
+ "os": 3,
+ "ot": 6
+ },
+ {
+ "os": 4,
+ "ot": 7
+ },
+ {
+ "os": 6,
+ "ot": 8
+ },
+ {
+ "os": 6,
+ "ot": 9
+ },
+ {
+ "os": 1,
+ "ot": 10
+ },
+ {
+ "os": 7,
+ "ot": 11
+ }
+ ]
+}
\ No newline at end of file
diff --git a/data/amr_sir.json b/data/amr_sir.json
new file mode 100644
index 00000000..0f3780ac
--- /dev/null
+++ b/data/amr_sir.json
@@ -0,0 +1,199 @@
+{
+ "name": "SIR Model",
+ "schema": "https://raw.githubusercontent.com/DARPA-ASKEM/Model-Representations/petrinet_v0.1/petrinet/petrinet_schema.json",
+ "description": "SIR model created by Ben, Micah, Brandon",
+ "model_version": "0.1",
+ "model": {
+ "states": [
+ {
+ "id": "S",
+ "name": "Susceptible",
+ "grounding": {
+ "identifiers": {
+ "ido": "0000514"
+ }
+ }
+ },
+ {
+ "id": "I",
+ "name": "Infected",
+ "grounding": {
+ "identifiers": {
+ "ido": "0000511"
+ }
+ }
+ },
+ {
+ "id": "R",
+ "name": "Recovered",
+ "grounding": {
+ "identifiers": {
+ "ido": "0000592"
+ }
+ }
+ }
+ ],
+ "transitions": [
+ {
+ "id": "inf",
+ "input": [
+ "S",
+ "I"
+ ],
+ "output": [
+ "I",
+ "I"
+ ],
+ "properties": {
+ "name": "Infection"
+ }
+ },
+ {
+ "id": "rec",
+ "input": [
+ "I"
+ ],
+ "output": [
+ "R"
+ ],
+ "properties": {
+ "name": "Recovery"
+ }
+ }
+ ]
+ },
+ "semantics": {
+ "ode": {
+ "rates": [
+ {
+ "target": "inf",
+ "expression": "S*I*beta",
+ "expression_mathml": "SIbeta"
+ },
+ {
+ "target": "rec",
+ "expression": "I*gamma",
+ "expression_mathml": "Igamma"
+ }
+ ],
+ "initials": [
+ {
+ "target": "S",
+ "expression": "S0",
+ "expression_mathml": "S0"
+ },
+ {
+ "target": "I",
+ "expression": "I0",
+ "expression_mathml": "I0"
+ },
+ {
+ "target": "R",
+ "expression": "R0",
+ "expression_mathml": "R0"
+ }
+ ],
+ "parameters": [
+ {
+ "id": "beta",
+ "description": "infection rate",
+ "value": 0.027,
+ "distribution": {
+ "type": "StandardUniform1",
+ "parameters": {
+ "minimum": 0.026,
+ "maximum": 0.028
+ }
+ }
+ },
+ {
+ "id": "gamma",
+ "description": "recovery rate",
+ "grounding": {
+ "identifiers": {
+ "askemo": "0000013"
+ }
+ },
+ "value": 0.14,
+ "distribution": {
+ "type": "StandardUniform1",
+ "parameters": {
+ "minimum": 0.1,
+ "maximum": 0.18
+ }
+ }
+ },
+ {
+ "id": "S0",
+ "description": "Total susceptible population at timestep 0",
+ "value": 1000
+ },
+ {
+ "id": "I0",
+ "description": "Total infected population at timestep 0",
+ "value": 1
+ },
+ {
+ "id": "R0",
+ "description": "Total recovered population at timestep 0",
+ "value": 0
+ }
+ ]
+ }
+ },
+ "metadata": {
+ "processed_at": 1682964953,
+ "processed_by": "mit:process-node1",
+ "variable_statements": [
+ {
+ "id": "v0",
+ "variable": {
+ "id": "v0",
+ "name": "VE",
+ "metadata": [
+ {
+ "type": "text_annotation",
+ "value": " Vaccine Effectiveness"
+ },
+ {
+ "type": "text_annotation",
+ "value": " Vaccine Effectiveness"
+ }
+ ],
+ "dkg_groundings": [],
+ "column": [
+ {
+ "id": "9-2",
+ "name": "new_persons_vaccinated",
+ "dataset": {
+ "id": "9",
+ "name": "usa-vaccinations.csv",
+ "metadata": "https://github.com/DARPA-ASKEM/program-milestones/blob/main/6-month-milestone/evaluation/scenario_3/ta_1/google-health-data/usa-vaccinations.csv"
+ }
+ },
+ {
+ "id": "9-3",
+ "name": "cumulative_persons_vaccinated",
+ "dataset": {
+ "id": "9",
+ "name": "usa-vaccinations.csv",
+ "metadata": "https://github.com/DARPA-ASKEM/program-milestones/blob/main/6-month-milestone/evaluation/scenario_3/ta_1/google-health-data/usa-vaccinations.csv"
+ }
+ }
+ ],
+ "paper": {
+ "id": "COVID-19 Vaccine Effectiveness by Product and Timing in New York State",
+ "file_directory": "https://www.medrxiv.org/content/10.1101/2021.10.08.21264595v1",
+ "doi": "10.1101/2021.10.08.21264595"
+ },
+ "equations": []
+ },
+ "metadata": [],
+ "provenance": {
+ "method": "MIT annotation",
+ "description": "text, dataset, formula annotation (chunwei@mit.edu)"
+ }
+ }
+ ]
+ }
+}
diff --git a/data/sir.json b/data/sir.json
new file mode 100644
index 00000000..6b380747
--- /dev/null
+++ b/data/sir.json
@@ -0,0 +1,49 @@
+{
+ "T": [
+ {
+ "tname": "inf"
+ },
+ {
+ "tname": "rec"
+ }
+ ],
+ "S": [
+ {
+ "sname": "S"
+ },
+ {
+ "sname": "I"
+ },
+ {
+ "sname": "R"
+ }
+ ],
+ "I": [
+ {
+ "it": 1,
+ "is": 1
+ },
+ {
+ "it": 1,
+ "is": 2
+ },
+ {
+ "it": 2,
+ "is": 2
+ }
+ ],
+ "O": [
+ {
+ "ot": 1,
+ "os": 2
+ },
+ {
+ "ot": 1,
+ "os": 2
+ },
+ {
+ "ot": 2,
+ "os": 3
+ }
+ ]
+}
\ No newline at end of file
diff --git a/data/sird.json b/data/sird.json
new file mode 100644
index 00000000..491a953e
--- /dev/null
+++ b/data/sird.json
@@ -0,0 +1 @@
+{"T":[{"tname":"inf"},{"tname":"rec"},{"tname":"death"}],"S":[{"sname":"S"},{"sname":"I"},{"sname":"R"},{"sname":"D"}],"I":[{"it":1,"is":1},{"it":1,"is":2},{"it":2,"is":2},{"it":3,"is":2}],"O":[{"ot":1,"os":2},{"ot":1,"os":2},{"ot":2,"os":3},{"ot":3,"os":4}]}
\ No newline at end of file
diff --git a/data/sirh.json b/data/sirh.json
new file mode 100644
index 00000000..f2b64a3a
--- /dev/null
+++ b/data/sirh.json
@@ -0,0 +1 @@
+{"T":[{"tname":"inf"},{"tname":"rec"},{"tname":"hosp"},{"tname":"hrec"}],"S":[{"sname":"S"},{"sname":"I"},{"sname":"R"},{"sname":"H"}],"I":[{"it":1,"is":1},{"it":1,"is":2},{"it":2,"is":2},{"it":3,"is":2},{"it":4,"is":4}],"O":[{"ot":1,"os":2},{"ot":1,"os":2},{"ot":2,"os":3},{"ot":3,"os":4},{"ot":4,"os":3}]}
\ No newline at end of file
diff --git a/data/sirhd.json b/data/sirhd.json
new file mode 100644
index 00000000..96c54294
--- /dev/null
+++ b/data/sirhd.json
@@ -0,0 +1,99 @@
+{
+ "T": [
+ {
+ "tname": "inf"
+ },
+ {
+ "tname": "rec"
+ },
+ {
+ "tname": "hosp"
+ },
+ {
+ "tname": "ideath"
+ },
+ {
+ "tname": "hrec"
+ },
+ {
+ "tname": "death"
+ }
+ ],
+ "S": [
+ {
+ "sname": "S"
+ },
+ {
+ "sname": "I"
+ },
+ {
+ "sname": "R"
+ },
+ {
+ "sname": "H"
+ },
+ {
+ "sname": "D"
+ }
+ ],
+ "I": [
+ {
+ "it": 1,
+ "is": 1
+ },
+ {
+ "it": 1,
+ "is": 2
+ },
+ {
+ "it": 2,
+ "is": 2
+ },
+ {
+ "it": 3,
+ "is": 2
+ },
+ {
+ "it": 4,
+ "is": 2
+ },
+ {
+ "it": 5,
+ "is": 4
+ },
+ {
+ "it": 6,
+ "is": 4
+ }
+ ],
+ "O": [
+ {
+ "ot": 1,
+ "os": 2
+ },
+ {
+ "ot": 1,
+ "os": 2
+ },
+ {
+ "ot": 2,
+ "os": 3
+ },
+ {
+ "ot": 3,
+ "os": 4
+ },
+ {
+ "ot": 4,
+ "os": 5
+ },
+ {
+ "ot": 5,
+ "os": 3
+ },
+ {
+ "ot": 6,
+ "os": 5
+ }
+ ]
+}
\ No newline at end of file
diff --git a/docs/make.jl b/docs/make.jl
index 5cc4b6bd..9da4424f 100644
--- a/docs/make.jl
+++ b/docs/make.jl
@@ -46,6 +46,7 @@ makedocs(sitename = "EasyModelAnalysis.jl",
"tutorials/datafitting.md",
"tutorials/threshold_interventions.md",
"tutorials/probabilistic_thresholds.md",
+ "tutorials/ensemble.md",
],
"Examples" => [
"examples/petri.md",
diff --git a/docs/src/tutorials/ensemble.md b/docs/src/tutorials/ensemble.md
new file mode 100644
index 00000000..c148c728
--- /dev/null
+++ b/docs/src/tutorials/ensemble.md
@@ -0,0 +1,18 @@
+# Ensemble modeling
+
+Continuing from the datafitting tutorial, we see a few extra complications that arise when dealing with collections of models.
+
+I have some data and I have some models.
+I want to know which models fit the data the best.
+
+Problem: the column names are not necesarily the same as the model symbols.
+We need a way to canonicalize them.
+
+To resolve this, we provide a mapping from model expressions to column names for each model.
+A problem with this approach is that the mapping does not necesarily have to be the same length
+This means that the data being fit can be different for each model.
+
+This isn't necesarily a problem but can lead to confusion.
+Should we assume or assert that the data being fit is the same?
+
+I think the answer is yes.
diff --git a/pn_amr_sir.json b/pn_amr_sir.json
new file mode 100644
index 00000000..04d53f99
--- /dev/null
+++ b/pn_amr_sir.json
@@ -0,0 +1,102 @@
+{
+ "T": [
+ {
+ "tname": "inf",
+ "tprop": {
+ "output": [
+ "I",
+ "I"
+ ],
+ "properties": {
+ "name": "Infection"
+ },
+ "id": "inf",
+ "input": [
+ "S",
+ "I"
+ ]
+ }
+ },
+ {
+ "tname": "rec",
+ "tprop": {
+ "output": [
+ "R"
+ ],
+ "properties": {
+ "name": "Recovery"
+ },
+ "id": "rec",
+ "input": [
+ "I"
+ ]
+ }
+ }
+ ],
+ "S": [
+ {
+ "sname": "S",
+ "sprop": {
+ "name": "Susceptible",
+ "id": "S",
+ "grounding": {
+ "identifiers": {
+ "ido": "0000514"
+ }
+ }
+ }
+ },
+ {
+ "sname": "I",
+ "sprop": {
+ "name": "Infected",
+ "id": "I",
+ "grounding": {
+ "identifiers": {
+ "ido": "0000511"
+ }
+ }
+ }
+ },
+ {
+ "sname": "R",
+ "sprop": {
+ "name": "Recovered",
+ "id": "R",
+ "grounding": {
+ "identifiers": {
+ "ido": "0000592"
+ }
+ }
+ }
+ }
+ ],
+ "I": [
+ {
+ "it": 1,
+ "is": 1
+ },
+ {
+ "it": 1,
+ "is": 2
+ },
+ {
+ "it": 2,
+ "is": 2
+ }
+ ],
+ "O": [
+ {
+ "ot": 1,
+ "os": 2
+ },
+ {
+ "ot": 1,
+ "os": 2
+ },
+ {
+ "ot": 2,
+ "os": 3
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/datafit.jl b/src/datafit.jl
index 3defd68b..eb2cf651 100644
--- a/src/datafit.jl
+++ b/src/datafit.jl
@@ -19,6 +19,7 @@ function relative_l2loss(pvals, (prob, pkeys, t, data))
end
return tot_loss
end
+
"""
datafit(prob, p, t, data)
@@ -35,22 +36,27 @@ Fit parameters `p` to `data` measured at times `t`.
- `loss`: the loss function used for fitting. Defaults to `EasyModelAnalysis.l2loss`,
with an alternative being `EasyModelAnalysis.relative_l2loss` for relative weighted error.
+ - `lb`: lower bounds for the parameters. Defaults to `fill(-Inf, length(p))`.
+ - `ub`: upper bounds for the parameters. Defaults to `fill(Inf, length(p))`.
+ - `alg`: the optimization algorithm to use. Defaults to `NLopt.LN_SBPLX()`.
+ - `solve_kws`: keyword arguments to pass to `solve`.
`p` does not have to contain all the parameters required to solve `prob`,
it can be a subset of parameters. Other parameters necessary to solve `prob`
default to the parameter values found in `prob.p`.
Similarly, not all states must be measured.
"""
-function datafit(prob, p::Vector{Pair{Num, Float64}}, t, data; loss = l2loss)
+function datafit(prob, p::Vector{Pair{Num, Float64}}, t, data; loss = l2loss,
+ lb = fill(-Inf, length(p)),
+ ub = fill(Inf, length(p)), alg = NLopt.LN_SBPLX(), solve_kws = (;))
pvals = getfield.(p, :second)
pkeys = getfield.(p, :first)
- oprob = OptimizationProblem(loss, pvals,
- lb = fill(-Inf, length(p)),
- ub = fill(Inf, length(p)), (prob, pkeys, t, data))
- res = solve(oprob, NLopt.LN_SBPLX())
+ oprob = OptimizationProblem(loss, pvals, (prob, pkeys, t, data);
+ lb,
+ ub)
+ res = solve(oprob, alg; solve_kws...)
Pair.(pkeys, res.u)
end
-
"""
global_datafit(prob, pbounds, t, data; maxiters = 10000)
@@ -69,23 +75,30 @@ Fit parameters `p` to `data` measured at times `t`.
robust.
- `loss`: the loss function used for fitting. Defaults to `EasyModelAnalysis.l2loss`, with an alternative
being `EasyModelAnalysis.relative_l2loss` for relative weighted error.
+ - `alg`: the optimization algorithm to use. Defaults to `BBO_adaptive_de_rand_1_bin_radiuslimited`.
+ - `u0`: initial guess for the parameters. Defaults to the midpoint of the bounds.
+ - `solve_kws`: keyword arguments to pass to `solve`.
`p` does not have to contain all the parameters required to solve `prob`,
it can be a subset of parameters. Other parameters necessary to solve `prob`
default to the parameter values found in `prob.p`.
Similarly, not all states must be measured.
"""
-function global_datafit(prob, pbounds, t, data; maxiters = 10000, loss = l2loss)
+function global_datafit(prob, pbounds, t, data; maxiters = 10000, loss = l2loss,
+ alg = BBO_adaptive_de_rand_1_bin_radiuslimited(),
+ u0 = nothing,
+ solve_kws = (;))
plb = getindex.(getfield.(pbounds, :second), 1)
pub = getindex.(getfield.(pbounds, :second), 2)
pkeys = getfield.(pbounds, :first)
- oprob = OptimizationProblem(loss, (pub .+ plb) ./ 2,
- lb = plb, ub = pub, (prob, pkeys, t, data))
- res = solve(oprob, BBO_adaptive_de_rand_1_bin_radiuslimited(); maxiters)
+ u0 = isnothing(u0) ? (pub .+ plb) ./ 2 : u0
+ oprob = OptimizationProblem(loss, u0, (prob, pkeys, t, data);
+ lb = plb, ub = pub)
+ res = solve(oprob, alg; maxiters, solve_kws...)
Pair.(pkeys, res.u)
end
-@model function bayesianODE(prob, t, p, data, noise_prior)
+Turing.@model function bayesianODE(prob, t, p, data, noise_prior)
σ ~ noise_prior
pdist = getfield.(p, :second)
pkeys = getfield.(p, :first)
diff --git a/src/ensemble.jl b/src/ensemble.jl
new file mode 100644
index 00000000..8ea5ea2f
--- /dev/null
+++ b/src/ensemble.jl
@@ -0,0 +1,108 @@
+function ModelingToolkit.ODESystem(p::PropertyLabelledReactionNet; name = :MiraNet, kws...)
+ t = first(@variables t)
+ D = Differential(t)
+ tm = TransitionMatrices(p)
+ coefficients = tm.output - tm.input
+
+ sname′(i) =
+ if has_subpart(p, :sname)
+ sname(p, i)
+ else
+ Symbol("S", i)
+ end
+ tname′(i) =
+ if has_subpart(p, :tname)
+ tname(p, i)
+ else
+ Symbol("r", i)
+ end
+
+ S = [first(@variables $Si(t)) for Si in sname′.(1:ns(p))]
+ S_ = [first(@variables $Si) for Si in sname′.(1:ns(p))] # MathML doesn't know whether a Num should be dependent on t, so we use this to substitute
+ st_sub_map = S_ .=> S
+
+ t_ps, flux_eqs = parse_tprops(p)
+ s_ps = union(parse_prop_parameters.(sprops(p))...)
+ ps = union(t_ps, s_ps)
+ ps_sub_vars = [only(@variables $x) for x in Symbolics.getname.(ps)]
+ ps_sub_map = ps_sub_vars .=> ps
+
+ subs = [ps_sub_map; st_sub_map]
+ subd = Dict(subs)
+
+ flux_eqs = map(x -> substitute(x, subd), flux_eqs)
+ tvars = ModelingToolkit.lhss(flux_eqs)
+
+ default_p = ps .=> ModelingToolkit.getdefault.(ps)
+ default_u0 = S .=> p[:concentration]
+ defaults = Dict([default_p; default_u0])
+
+ observable_species_idxs = filter(i -> sprop(p, i)["is_observable"], 1:ns(p))
+ observable_species_names = Symbolics.getname.(S[observable_species_idxs])
+
+ # i don't understand where p[:rate] comes into play. it seems like rate is only needed if there aren't custom rate laws
+ deqs = [D(S[s]) ~ tvars' * coefficients[:, s]
+ for s in 1:ns(p) if Symbolics.getname(S[s]) ∉ observable_species_names]
+
+ # there should be a mathml but there isnt
+ obs_eqs = [substitute(S[i] ~ Symbolics.parse_expr_to_symbolic(Meta.parse(sprop(p, i)["expression"]),
+ @__MODULE__),
+ Dict(subs))
+ for i in observable_species_idxs]
+
+ eqs = Equation[flux_eqs; deqs; obs_eqs]
+ ODESystem(eqs, t; name, defaults, kws...)
+end
+
+"can give it a S or T and itll make the pars from the prop dict"
+function parse_prop_parameters(prop)
+ pars = []
+ !haskey(prop, "mira_parameters") && (return pars)
+
+ mps = JSON3.read(prop["mira_parameters"])
+ dists = JSON3.read(prop["mira_parameter_distributions"])
+ for (k, v) in mps
+ d = dists[k]
+ pname = Symbol(k)
+ if !isnothing(d) && haskey(d, "parameters")
+ d_ps = d["parameters"]
+ @assert d["type"] == "StandardUniform1"
+ b = (d_ps["minimum"], d_ps["maximum"])
+
+ par = only(@parameters $pname=v [bounds = b])
+ else
+ par = only(@parameters $pname = v)
+ end
+ push!(pars, par)
+ end
+ pars
+end
+
+function parse_tprops(p)
+ mira_ps = Set()
+ tps = tprops(p)
+ tp = first(tps)
+ flux_eqs = Equation[]
+ for i in 1:nt(p)
+ eq, pars = parse_tprop(p, i)
+ push!(flux_eqs, eq)
+
+ [push!(mira_ps, x) for x in pars] # no append!(set, xs)??
+ end
+ collect(mira_ps), flux_eqs
+end
+
+# doesn't really take a tprop, but the index
+function parse_tprop(p, i)
+ tp = tprop(p, i)
+ tn = tname(p, i)
+
+ pars = parse_prop_parameters(tp)
+
+ t = only(@parameters t)
+ tvar = only(@variables $tn(t))
+
+ rl = MathML.parse_str(tp["mira_rate_law_mathml"])
+ eq = tvar ~ rl
+ eq, pars
+end
diff --git a/test/amr.jl b/test/amr.jl
new file mode 100644
index 00000000..b297d85a
--- /dev/null
+++ b/test/amr.jl
@@ -0,0 +1,102 @@
+
+using AlgebraicPetri
+using Catlab.CategoricalAlgebra
+
+import JSON
+
+struct ASKEMPetriNet
+ petri::PropertyLabelledPetriNet
+ json::AbstractDict
+end
+
+function to_petri(file)
+ original_json = JSON.parsefile(file)
+ model = original_json["model"]
+ state_props = Dict(Symbol(s["id"]) => s for s in model["states"])
+ states = [Symbol(s["id"]) for s in model["states"]]
+ transition_props = Dict(Symbol(t["id"]) => t for t in model["transitions"])
+ transitions = [Symbol(t["id"]) => (Symbol.(t["input"]) => Symbol.(t["output"]))
+ for t in model["transitions"]]
+
+ petri = LabelledPetriNet(states, transitions...)
+ ASKEMPetriNet(PropertyLabelledPetriNet{Dict}(petri, state_props, transition_props),
+ original_json)
+end
+
+function update_properties!(pn)
+ # TODO: Add support for stratified models with tuples of attributes -> arrays of properties
+ map(parts(pn, :S)) do s
+ pn[s, :sprop]["id"] = String(pn[s, :sname])
+ end
+ map(parts(pn, :T)) do t
+ props = pn[t, :tprop]
+ props["id"] = String(pn[t, :tname])
+ new_inputs = String.(pn[pn[incident(pn, t, :it), :is], :sname])
+ for (i, input) in enumerate(props["input"])
+ props["input"][i] = new_inputs[i]
+ end
+ new_outputs = String.(pn[pn[incident(pn, t, :ot), :os], :sname])
+ for (o, output) in enumerate(props["output"])
+ props["output"][o] = new_outputs[o]
+ end
+ end
+ pn
+end
+
+update_properties!(askem_net::ASKEMPetriNet) = update_properties!(askem_net.petri)
+
+function update_json!(askem_net::ASKEMPetriNet)
+ pn = askem_net.petri
+ askem_net.json["model"]["states"] = map(s -> pn[s, :sprop], parts(pn, :S))
+ askem_net.json["model"]["transitions"] = map(t -> pn[t, :tprop], parts(pn, :T))
+ askem_net.json
+end
+
+function update!(askem_net::ASKEMPetriNet)
+ update_properties!(askem_net)
+ update_json!(askem_net)
+end
+
+# JSON Interoperability
+#######################
+
+JSON.json(askem_net::ASKEMPetriNet) = JSON.json(askem_net.json)
+JSON.print(io::IO, askem_net::ASKEMPetriNet) = JSON.print(io, askem_net.json)
+function JSON.print(io::IO, askem_net::ASKEMPetriNet, indent)
+ JSON.print(io, askem_net.json, indent)
+end
+# Load a model
+file = "/Users/anand/code/julia/tmp/EasyModelAnalysis.jl/data/amr_sir.json"
+askemnet = to_petri(file)
+
+pn = askemnet.petri
+ODESystem(pn)
+
+@parameters t r=-1
+D = Differential(t)
+@variables x(t) = r
+@named foo = ODESystem([D(x) ~ x], t, [x], [r])
+solve(ODEProblem(foo, [], tspan))
+
+j = original_json
+ode = j["semantics"]["ode"]
+inits, params, rates = ode["initials"], ode["parameters"], ode["rates"]
+
+init = inits[1]
+s = init["target"]
+su0 = MathML.parse_str(init["expression_mathml"])
+@assert length(Symbolics.get_variables(su0)) == 1
+
+params
+param = params[1]
+function parse_param(param)
+ pid = Symbol(param["id"])
+ only(@parameters $pid=param["value"] [description = param["description"]])
+end
+sym_ps = parse_param.(params)
+pd = Dict(Symbol(p["id"]) => p["value"] for p in params)
+
+# if the u0 expression is anything more than just a plain parameter there'll be some issues
+
+s_sts_syms = [Symbol(s["id"]) for s in j["model"]["states"]]
+all_sts
\ No newline at end of file
diff --git a/test/ensemble.jl b/test/ensemble.jl
new file mode 100644
index 00000000..0504a251
--- /dev/null
+++ b/test/ensemble.jl
@@ -0,0 +1,268 @@
+# @time @time_imports using EasyModelAnalysis
+using EasyModelAnalysis
+using DataFrames, AlgebraicPetri, Catlab, Setfield, MathML, JSON3, CommonSolve
+using Downloads, CSV, URIs, DataFrames, Dates, AlgebraicPetri, MathML, Setfield
+using Catlab.CategoricalAlgebra: read_json_acset
+import Catlab.ACSetInterface: has_subpart
+EMA = EasyModelAnalysis
+datadir = joinpath(@__DIR__, "../data/")
+mkpath(datadir)
+
+function generate_sys_args(p::AbstractPetriNet)
+ t = first(@variables t)
+ sname′(i) =
+ if has_subpart(p, :sname)
+ sname(p, i)
+ else
+ Symbol("S", i)
+ end
+ tname′(i) =
+ if has_subpart(p, :tname)
+ tname(p, i)
+ else
+ Symbol("r", i)
+ end
+
+ S = [first(@variables $Si(t)) for Si in sname′.(1:ns(p))]
+ r = [first(@parameters $ri) for ri in tname′.(1:nt(p))]
+ D = Differential(t)
+
+ tm = TransitionMatrices(p)
+
+ coefficients = tm.output - tm.input
+
+ transition_rates = [r[tr] * prod(S[s]^tm.input[tr, s] for s in 1:ns(p))
+ for tr in 1:nt(p)]
+
+ eqs = [D(S[s]) ~ transition_rates' * coefficients[:, s] for s in 1:ns(p)]
+
+ eqs, t, S, r
+end
+
+function ModelingToolkit.ODESystem(rn::AbstractLabelledReactionNet; name = :ReactionNet,
+ kws...)
+ sys = ODESystem(generate_sys_args(rn)...; name = name, kws...)
+ defaults = get_rn_defaults(sys, rn)
+ @set! sys.defaults = defaults
+ sys
+end
+
+function CommonSolve.solve(sys::ODESystem; prob_kws = (;), solve_kws = (;), kws...)
+ solve(ODEProblem(sys; prob_kws..., kws...); solve_kws..., kws...)
+end
+
+function CommonSolve.solve(sys::SDESystem; prob_kws = (;), solve_kws = (;), kws...)
+ solve(SDEProblem(sys; prob_kws..., kws...); solve_kws..., kws...)
+end
+
+to_ssys(sys::ODESystem) = complete(structural_simplify(sys))
+to_ssys(pn) = to_ssys(ODESystem(pn))
+
+EMA.solve(pn::AbstractPetriNet; kws...) = solve(to_ssys(pn); kws...)
+getsys(sol) = sol.prob.f.sys
+getsys(prob::ODEProblem) = prob.f.sys
+
+ModelingToolkit.parameters(prob::ODEProblem) = parameters(getsys(prob))
+ModelingToolkit.states(prob::ODEProblem) = states(getsys(prob))
+
+"this doesn't necesarily get everything, use with caution"
+sys_syms(sys) = [states(sys); parameters(sys)]
+
+function st_defs(sys)
+ filter(x -> !ModelingToolkit.isparameter(x[1]),
+ collect(ModelingToolkit.defaults(sys)))
+end
+
+function p_defs(sys)
+ filter(x -> ModelingToolkit.isparameter(x[1]),
+ collect(ModelingToolkit.defaults(sys)))
+end
+
+to_data(df, mapping) = [k => df[:, v] for (k, v) in mapping]
+
+"""
+Separate keys and values
+"""
+_unzip(d::Dict) = (collect(keys(d)), collect(values(d)))
+"""
+Unzip a collection of pairs
+"""
+unzip(ps) = first.(ps), last.(ps)
+
+remove_t(x) = Symbol(replace(String(x), "(t)" => ""))
+
+function set_sys_defaults(sys, pn; kws...)
+ pn_defs = get_defaults(pn)
+ syms = sys_syms(sys)
+ defs = _symbolize_args(pn_defs, syms)
+ sys = ODESystem(pn; tspan = ModelingToolkit.get_tspan(sys), defaults = defs, kws...)
+end
+
+"""
+Transform list of args into Symbolics variables
+```julia
+@parameters sig
+
+_symbolize_args([:sig => 1], [sig])
+
+Dict{Num, Int64} with 1 entry:
+ sig => 1
+```
+"""
+function _symbolize_args(incoming_values, sys_vars)
+ pairs = collect(incoming_values)
+ ks, values = unzip(pairs)
+ symbols = Symbol.(ks)
+ vars_as_symbols = Symbolics.getname.(sys_vars)
+ symbols_to_vars = Dict(vars_as_symbols .=> sys_vars)
+ Dict([symbols_to_vars[vars_as_symbols[findfirst(x -> x == symbol, vars_as_symbols)]]
+ for symbol in symbols] .=> values)
+end
+
+function get_defaults(pn)
+ [snames(pn) .=> collect(pn[:concentration]); tnames(pn) .=> collect(pn[:rate])]
+end
+
+function get_rn_defaults(sys, rn)
+ _symbolize_args(get_defaults(rn), sys_syms(sys))
+end
+
+function to_data(sol::ODESolution; sts = states(getsys(sol)))
+ sts .=> [sol[x] for x in sts]
+end
+
+"this should take sts "
+function sol_df_to_t_data(df)
+ @parameters t
+ sts = [only(@variables $x(t)) for x in Symbol.(remove_t.(names(df)[2:end]))]
+ df.timestamp, sts .=> collect(eachcol(df)[2:end])
+end
+
+"helper to easily "
+function petri_bounds(prob; ps = parameters(getsys(prob)),
+ ranges = fill((0.0, 1.0), length(ps)))
+ ps .=> ranges
+end
+
+global losses = []
+global logged_p = []
+global opt_step = 0
+
+callback = function (p, l)
+ global opt_step += 1
+ if opt_step % 100 == 0
+ @show opt_step, l
+ push!(losses, deepcopy(l))
+ push!(logged_p, deepcopy(p))
+ # display(plot(losses))
+ end
+ return false
+end
+# fns = readdir(datadir; join = true)
+fns = joinpath.((datadir,), (["sir", "sirh", "sird", "sirhd"] .* ".json"))
+pns = [read_json_acset(LabelledPetriNet, fn) for fn in fns]
+p = pns[1]
+sir, sird, sirh, sirhd = pns
+
+tspan = (0.0, 100.0)
+saveat = 1
+
+s_defs = [
+ :S => 0.99,
+ :I => 0.01,
+ :R => 0.0,
+ :H => 0.0,
+ :D => 0.0,
+]
+
+ps_defs = [
+ :inf => 0.6,
+ :rec => 0.2,
+ :hosp => 0.1,
+ :ideath => 0.01,
+ :hrec => 0.05,
+ :death => 0.01,
+]
+sd = Dict(s_defs)
+psd = Dict(ps_defs)
+defs = merge(sd, psd)
+
+rn = LabelledReactionNet{Number, Number}(sirhd, s_defs, ps_defs)
+sol = solve(rn; tspan, saveat) # shortcut
+
+sys = ODESystem(rn)
+ssys = to_ssys(sys)
+prob = ODEProblem(ssys, [], tspan)
+sol = solve(prob; saveat = 1)
+df = DataFrame(sol)
+sts = states(ssys)
+
+rns = [LabelledReactionNet{Number, Number}(pn, s_defs, ps_defs) for pn in pns]
+syss = [to_ssys(rn) for rn in rns]
+sir, sird, sirh, sirhd = syss
+rprobs = [ODEProblem(sys, [], tspan) for sys in syss] # why does Distributions export `probs`?
+sols = solve.(rprobs; saveat)
+
+ists = intersect(states.(syss)...)
+data = to_data(sol; sts = ists)
+
+rprob = rprobs[1]
+fit = EMA.global_datafit(rprob, petri_bounds(rprob), df.timestamp, data;
+ solve_kws = (; callback))
+before_loss = EMA.l2loss(rprob.p, (rprob, parameters(rprob), df.timestamp, data))
+after_loss = EMA.l2loss(last.(fit), (rprob, first.(fit), df.timestamp, data))
+
+scores = [:sir, :sird, :sirh, :sirhd] .=>
+ EMA.model_forecast_score(rprobs, df.timestamp, data)
+
+fits = []
+for prob in rprobs
+ fit = EMA.global_datafit(prob, petri_bounds(prob), df.timestamp, data)
+ push!(fits, fit)
+end
+
+fits = [EMA.global_datafit(prob, petri_bounds(prob), df.timestamp, data) for prob in rprobs]
+# this was the "easy" case because state and parameter names overlapped, and allowed us to treat them as the same, using the same data across all fits
+
+# to get around this for the case where we have a model that has states Sus, Inf, Rec, and parameters infection_rate, recovery_rate
+sir2_rn = LabelledReactionNet{Number, Number}((:Sus => 0.99, :Inf => 0.01, :Rec => 0),
+ (:infection_rate, 0.3 / 1000) => ((:Sus, :Inf) => (:Inf,
+ :Inf)),
+ (:recovery_rate, 0.2) => (:Inf => :Rec))
+
+sir2 = complete(ODESystem(sir2_rn))
+prob2 = ODEProblem(sir2, [], tspan)
+# we need to provide a mapping to the data, so that we can use the same data across all fits
+# so what we do is create pairs that map states to fit against to DataFrame column names, which allows us to construct `data`
+
+
+function Base.getindex(sys::ODESystem, s::Symbol)
+ syms = sys_syms(sys)
+ syms[findfirst(==(s), Symbolics.getname.(syms))]
+end
+
+function Base.getindex(sys::ODESystem, syms::AbstractArray{Symbol})
+ [sys[s] for s in syms]
+end
+
+# datad = Dict(data)
+fit_syms = Symbol.(ists)
+fit_ns = Symbolics.getname.(ists)
+
+mapping2 = [
+ sir2.Sus => Symbol("S(t)"),
+ sir2.Inf => Symbol("I(t)"),
+ sir2.Rec => Symbol("R(t)"),
+]
+data2 = to_data(df, mapping2)
+
+mapping = sys[fit_ns] .=> fit_syms
+prob_mapping_ps = []
+
+bounds = parameters(getsys(prob2)) .=> ((0.0, 1.0),)
+
+fit = EMA.global_datafit(prob2, bounds, df.timestamp, data2)
+
+# function EMA.global_datafit(probs)
+
+# function amr_to_odesys(fn)
\ No newline at end of file
diff --git a/test/failed.jl b/test/failed.jl
new file mode 100644
index 00000000..327bdda8
--- /dev/null
+++ b/test/failed.jl
@@ -0,0 +1,140 @@
+
+# gi(xs, y) = map(x -> x[y], xs)
+# cv(x) = collect(values(x))
+# read_replace_write(fn, rs) = write(fn, replace(read(fn, String), rs...))
+# function fits_to_df(fits)
+# DataFrame(namedtuple.([Symbolics.getname.(ks) .=> vs for (ks, vs) in EMA.unzip.(fits)]))
+# end
+
+# function logged_p_df(pkeys, logged_p)
+# DataFrame(stack(logged_p)', Symbolics.getname.(pkeys))
+# end
+
+# function fit_plot(sol, df, sts)
+# plt = EMA.plot_covidhub(df)
+# plt = scatter!(plt, sol; idxs = sts)
+# display(plt)
+# end
+
+function download_data(url, dd)
+ filename = joinpath(dd, URIs.unescapeuri(split(url, "/")[end]))
+ if !isfile(filename)
+ Downloads.download(url, filename)
+ end
+ filename
+end
+
+function get_covidhub_data(url, dd)
+ return CSV.read(download_data(url, dd), DataFrame)
+end
+
+select_location(df, location) = df[df.location .== location, :]
+select_location(location) = df -> select_location(df, location)
+
+function date_join(colnames, dfs...)
+ d_ = innerjoin(dfs..., on = :date, makeunique = true)
+ d = d_[:, colnames]
+ return sort!(d, :date)
+end
+
+function groupby_week(df)
+ first_monday = first(df.date) - Day(dayofweek(first(df.date)) - 2) % 7
+ df.t = (Dates.value.(df.date .- first_monday) .+ 1) .÷ 7
+
+ weekly_summary = combine(groupby(df, :t),
+ :cases => sum,
+ :deaths => sum,
+ :hosp => sum)
+
+ rename!(weekly_summary, [:t, :cases, :deaths, :hosp])
+ weekly_summary
+end
+
+dfc = get_covidhub_data("https://github.com/reichlab/covid19-forecast-hub/raw/master/data-truth/truth-Cumulative%20Cases.csv",
+ datadir)
+dfd = get_covidhub_data("https://github.com/reichlab/covid19-forecast-hub/raw/master/data-truth/truth-Cumulative%20Deaths.csv",
+ datadir)
+dfh = get_covidhub_data("https://github.com/reichlab/covid19-forecast-hub/raw/master/data-truth/truth-Cumulative%20Hospitalizations.csv",
+ datadir)
+ # select location to use
+dfc, dfd, dfh = map(select_location("US"), [dfc, dfd, dfh])
+
+# "US" isn't in the hospitalization data
+# rename to synchronize dataset column names with models
+rename!(dfc, :value => :cases)
+rename!(dfd, :value => :deaths)
+rename!(dfh, :value => :hosp)
+
+# create combined dataframe joined on date
+covidhub = EMA.date_join([:date, :cases, :deaths, :hosp], dfc, dfd, dfh)
+
+# aggregate to week-level data
+df = EMA.groupby_week(covidhub)
+
+"rescale data to be proportion of population"
+function scale_df!(df)
+ for c in names(df)[2:end]
+ df[!, c] = df[!, c] ./ total_pop
+ end
+end
+
+
+# how do you validate that the exprs in data will not error when sol[x] is called?
+struct Ensemble
+ df::Any
+ prob_mapping_pairs::Any
+end
+
+# another way of doing this canonicalization is to add observed equations
+# this means that a single `data` is used across all fits
+data_sts = first.(data)
+@unpack Sus, Inf, Rec = sir2
+@unpack S, I, R = sys
+
+obs_eqs = [
+ S ~ Sus,
+ I ~ Inf,
+ R ~ Rec,
+]
+@set! sir2.observed = obs_eqs
+observed(sir2)
+sol2 = solve(sir2; tspan, saveat)
+sol2[S]
+prob2 = ODEProblem(sir2)
+sol2 = solve(prob2; tspan=(0., 1e5), saveat)
+sol2[S]
+plot(sol2; idxs=data_sts)
+plot(sol2)
+
+fit = EMA.global_datafit(prob2, petri_bounds(prob2), df.timestamp, data)
+# so now we can use a
+all_probs = [rprobs; [prob2]]
+fits = []
+for prob in all_probs
+ bounds = parameters(getsys(prob)) .=> ((0.0, 1.0),)
+ fit = EMA.global_datafit(prob, bounds, df.timestamp, data)
+ push!(fits, fit)
+end
+
+
+
+@named sdesys2 = SDESystem(sys, []; tspan)
+sp = SDEProblem(sdesys2)
+ssol = Array(solve(sp; saveat))
+ssol2 = Array(solve(ODEProblem(sdesys2); saveat))
+@test isapprox(ssol, ssol2; rtol = 1e-4)
+
+plot(ssol)
+ssol = solve(sdesys)
+# what is the right assertion for the df to be a timeseries?
+# first column is riskier but more general than assuming its :t or :timestamp
+function ModelingToolkit.SDESystem(sys::ODESystem, neqs; kwargs...)
+ SDESystem(ModelingToolkit.equations(sys), neqs, ModelingToolkit.get_iv(sys),
+ ModelingToolkit.states(sys), ModelingToolkit.parameters(sys);
+ tspan = ModelingToolkit.get_tspan(sys),
+ defaults = ModelingToolkit.defaults(sys), kwargs...)
+end
+
+@named sdesys = SDESystem(sys, 1 .* states(sys); tspan = (0, 1e3))
+ssol = solve(sdesys; saveat)
+plot(ssol; idxs = sdesys.H)
\ No newline at end of file