From caeb2f718eff588e83868c9bfcf4e38ee2055c3f Mon Sep 17 00:00:00 2001 From: Five Grant <5@fivegrant.com> Date: Tue, 11 Jul 2023 10:51:00 -0500 Subject: [PATCH] Update docs, examples + Fix intermediate hook (#62) --- ARCHITECTURE.md | 20 + README.md | 17 +- examples/BIOMD0000000955_askenet.json | 693 ++++++++++++++++++ examples/BIOMD0000000955_miranet.json | 523 ------------- examples/example-model.json | 1 - .../request-calibrate-no-integration.json | 8 + examples/request-calibrate.json | 23 - ....json => request-simulate-integrated.json} | 0 examples/request-simulate-no-integration.json | 4 + paths.yaml | 12 +- src/operations/Operations.jl | 4 +- src/service/ArgIO.jl | 22 +- src/service/Execution.jl | 8 +- 13 files changed, 769 insertions(+), 566 deletions(-) create mode 100644 ARCHITECTURE.md create mode 100644 examples/BIOMD0000000955_askenet.json delete mode 100644 examples/BIOMD0000000955_miranet.json delete mode 100644 examples/example-model.json create mode 100644 examples/request-calibrate-no-integration.json delete mode 100644 examples/request-calibrate.json rename examples/{request-simulate.json => request-simulate-integrated.json} (100%) create mode 100644 examples/request-simulate-no-integration.json diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md new file mode 100644 index 0000000..de4a5b7 --- /dev/null +++ b/ARCHITECTURE.md @@ -0,0 +1,20 @@ +# Architecture + +The Simulation Service (soon to be renamed SciML Service) is a REST API that wraps +specific SciML tasks. The service should match the spec [here](https://github.com/DARPA-ASKEM/simulation-api-spec) +since PyCIEMSS Service and SciML Service ideally are hot swappable. + +The API creates a job using the JobSchedulers.jl library and updates the Terarium Data Service (TDS) with the status +of the job throughout its execution. Once the job completes, the results are written to S3. With most of the output artifacts, we do little postprocessing +after completing the SciML portion. + +## Layout + +Source is split into 5 major components: +- `SimulationService.jl`: Contains the start and stop functions for the service +- `Settings.jl`: Enumerates the environment variables used by the project +- `service`: Job scheduling, pre/post-processing, endpoints, etc. Handled by TA4. +- `contracts`: Location where TA3 and TA4 agree on an interface between the SciML Operations and the rest of the service. + - `Available.jl`: The operations available to the API are here. Generally, the operations just wrap around by the exposed SciML + operations. +- `operations`: JuliaHub primarily focuses here. \ No newline at end of file diff --git a/README.md b/README.md index c84f4de..cbc6b1a 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,25 @@ With docker compose: docker compose --file docker/docker-compose.yml up --build ``` -With Julia REPL: +With Julia REPL assuming you want to run it standalone: ``` -julia> using SimulationService +>> export ENABLE_TDS=false # Include if you would like to disable backend services +>> julia --project --threads 15 # We need multithreading +julia> using SimulationService, HTTP +julia> import JSON3 as JSON julia> start!() +julia> model_json = String(read("./examples/BIOMD0000000955_askenet.json")) +julia> # Let's do a simulate +julia> operation = "simulate" +julia> operation_args = Dict(:model=> model_json, :timespan => Dict("start" => 0, "end" => 90)) # should match up to what's in Availble.jl +julia> simulation = SimulationService.make_deterministic_run(operation_args, operation) +julia> simulation_id = JSON.read(String(simulation.body)).simulation_id +julia> status = SimulationService.retrieve_job(nothing, simulation_id, "status") # rerun until complete +julia> result = SimulationService.retrieve_job(nothing, simulation_id, "result") julia> # output of REST API and Scheduler julia> stop!() julia> # you may safely leave the repl or rerun `start!` ```` + +To check available endpoints, try checking [localhost:8080/docs](localhost:8080/docs) diff --git a/examples/BIOMD0000000955_askenet.json b/examples/BIOMD0000000955_askenet.json new file mode 100644 index 0000000..a1b78f7 --- /dev/null +++ b/examples/BIOMD0000000955_askenet.json @@ -0,0 +1,693 @@ +{ + "name": "Giordano2020 - SIDARTHE model of COVID-19 spread in Italy", + "schema": "https://raw.githubusercontent.com/DARPA-ASKEM/Model-Representations/petrinet_v0.5/petrinet/petrinet_schema.json", + "schema_name": "petrinet", + "description": "Giordano2020 - SIDARTHE model of COVID-19 spread in Italy", + "model_version": "0.1", + "properties": {}, + "model": { + "states": [ + { + "id": "Susceptible", + "name": "Susceptible", + "grounding": { + "identifiers": { + "ido": "0000514" + }, + "modifiers": {} + }, + "units": { + "expression": "1", + "expression_mathml": "1" + } + }, + { + "id": "Diagnosed", + "name": "Diagnosed", + "grounding": { + "identifiers": { + "ido": "0000511" + }, + "modifiers": { + "diagnosis": "ncit:C15220" + } + }, + "units": { + "expression": "1", + "expression_mathml": "1" + } + }, + { + "id": "Infected", + "name": "Infected", + "grounding": { + "identifiers": { + "ido": "0000511" + }, + "modifiers": {} + }, + "units": { + "expression": "1", + "expression_mathml": "1" + } + }, + { + "id": "Ailing", + "name": "Ailing", + "grounding": { + "identifiers": { + "ido": "0000511" + }, + "modifiers": { + "disease_severity": "ncit:C25269", + "diagnosis": "ncit:C113725" + } + }, + "units": { + "expression": "1", + "expression_mathml": "1" + } + }, + { + "id": "Recognized", + "name": "Recognized", + "grounding": { + "identifiers": { + "ido": "0000511" + }, + "modifiers": { + "diagnosis": "ncit:C15220" + } + }, + "units": { + "expression": "1", + "expression_mathml": "1" + } + }, + { + "id": "Healed", + "name": "Healed", + "grounding": { + "identifiers": { + "ido": "0000592" + }, + "modifiers": {} + }, + "units": { + "expression": "1", + "expression_mathml": "1" + } + }, + { + "id": "Threatened", + "name": "Threatened", + "grounding": { + "identifiers": { + "ido": "0000511" + }, + "modifiers": { + "disease_severity": "ncit:C25467" + } + }, + "units": { + "expression": "1", + "expression_mathml": "1" + } + }, + { + "id": "Extinct", + "name": "Extinct", + "grounding": { + "identifiers": { + "ncit": "C28554" + }, + "modifiers": {} + }, + "units": { + "expression": "1", + "expression_mathml": "1" + } + } + ], + "transitions": [ + { + "id": "t1", + "input": [ + "Diagnosed", + "Susceptible" + ], + "output": [ + "Diagnosed", + "Infected" + ], + "properties": { + "name": "t1" + } + }, + { + "id": "t2", + "input": [ + "Ailing", + "Susceptible" + ], + "output": [ + "Ailing", + "Infected" + ], + "properties": { + "name": "t2" + } + }, + { + "id": "t3", + "input": [ + "Recognized", + "Susceptible" + ], + "output": [ + "Recognized", + "Infected" + ], + "properties": { + "name": "t3" + } + }, + { + "id": "t4", + "input": [ + "Infected", + "Susceptible" + ], + "output": [ + "Infected", + "Infected" + ], + "properties": { + "name": "t4" + } + }, + { + "id": "t5", + "input": [ + "Infected" + ], + "output": [ + "Diagnosed" + ], + "properties": { + "name": "t5" + } + }, + { + "id": "t6", + "input": [ + "Infected" + ], + "output": [ + "Ailing" + ], + "properties": { + "name": "t6" + } + }, + { + "id": "t7", + "input": [ + "Infected" + ], + "output": [ + "Healed" + ], + "properties": { + "name": "t7" + } + }, + { + "id": "t8", + "input": [ + "Diagnosed" + ], + "output": [ + "Recognized" + ], + "properties": { + "name": "t8" + } + }, + { + "id": "t9", + "input": [ + "Diagnosed" + ], + "output": [ + "Healed" + ], + "properties": { + "name": "t9" + } + }, + { + "id": "t10", + "input": [ + "Ailing" + ], + "output": [ + "Recognized" + ], + "properties": { + "name": "t10" + } + }, + { + "id": "t11", + "input": [ + "Ailing" + ], + "output": [ + "Healed" + ], + "properties": { + "name": "t11" + } + }, + { + "id": "t12", + "input": [ + "Ailing" + ], + "output": [ + "Threatened" + ], + "properties": { + "name": "t12" + } + }, + { + "id": "t13", + "input": [ + "Recognized" + ], + "output": [ + "Threatened" + ], + "properties": { + "name": "t13" + } + }, + { + "id": "t14", + "input": [ + "Recognized" + ], + "output": [ + "Healed" + ], + "properties": { + "name": "t14" + } + }, + { + "id": "t15", + "input": [ + "Threatened" + ], + "output": [ + "Extinct" + ], + "properties": { + "name": "t15" + } + }, + { + "id": "t16", + "input": [ + "Threatened" + ], + "output": [ + "Healed" + ], + "properties": { + "name": "t16" + } + } + ] + }, + "semantics": { + "ode": { + "rates": [ + { + "target": "t1", + "expression": "Diagnosed*Susceptible*beta", + "expression_mathml": "DiagnosedSusceptiblebeta" + }, + { + "target": "t2", + "expression": "Ailing*Susceptible*gamma", + "expression_mathml": "AilingSusceptiblegamma" + }, + { + "target": "t3", + "expression": "Recognized*Susceptible*delta", + "expression_mathml": "RecognizedSusceptibledelta" + }, + { + "target": "t4", + "expression": "Infected*Susceptible*alpha", + "expression_mathml": "InfectedSusceptiblealpha" + }, + { + "target": "t5", + "expression": "Infected*epsilon", + "expression_mathml": "Infectedepsilon" + }, + { + "target": "t6", + "expression": "Infected*zeta", + "expression_mathml": "Infectedzeta" + }, + { + "target": "t7", + "expression": "Infected*lambda", + "expression_mathml": "Infectedlambda" + }, + { + "target": "t8", + "expression": "Diagnosed*eta", + "expression_mathml": "Diagnosedeta" + }, + { + "target": "t9", + "expression": "Diagnosed*rho", + "expression_mathml": "Diagnosedrho" + }, + { + "target": "t10", + "expression": "Ailing*theta", + "expression_mathml": "Ailingtheta" + }, + { + "target": "t11", + "expression": "Ailing*kappa", + "expression_mathml": "Ailingkappa" + }, + { + "target": "t12", + "expression": "Ailing*mu", + "expression_mathml": "Ailingmu" + }, + { + "target": "t13", + "expression": "Recognized*nu", + "expression_mathml": "Recognizednu" + }, + { + "target": "t14", + "expression": "Recognized*xi", + "expression_mathml": "Recognizedxi" + }, + { + "target": "t15", + "expression": "Threatened*tau", + "expression_mathml": "Threatenedtau" + }, + { + "target": "t16", + "expression": "Threatened*sigma", + "expression_mathml": "Threatenedsigma" + } + ], + "initials": [ + { + "target": "Susceptible", + "expression": "0.999996300000000", + "expression_mathml": "0.99999629999999995" + }, + { + "target": "Diagnosed", + "expression": "3.33333333000000e-7", + "expression_mathml": "3.33333333e-7" + }, + { + "target": "Infected", + "expression": "3.33333333000000e-6", + "expression_mathml": "3.3333333299999999e-6" + }, + { + "target": "Ailing", + "expression": "1.66666666000000e-8", + "expression_mathml": "1.6666666599999999e-8" + }, + { + "target": "Recognized", + "expression": "3.33333333000000e-8", + "expression_mathml": "3.33333333e-8" + }, + { + "target": "Healed", + "expression": "0.0", + "expression_mathml": "0.0" + }, + { + "target": "Threatened", + "expression": "0.0", + "expression_mathml": "0.0" + }, + { + "target": "Extinct", + "expression": "0.0", + "expression_mathml": "0.0" + } + ], + "parameters": [ + { + "id": "beta", + "value": 0.011, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.008799999999999999, + "maximum": 0.0132 + } + } + }, + { + "id": "gamma", + "value": 0.456, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.3648, + "maximum": 0.5472 + } + } + }, + { + "id": "delta", + "value": 0.011, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.008799999999999999, + "maximum": 0.0132 + } + } + }, + { + "id": "alpha", + "value": 0.57, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.45599999999999996, + "maximum": 0.6839999999999999 + } + } + }, + { + "id": "epsilon", + "value": 0.171, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.1368, + "maximum": 0.20520000000000002 + } + } + }, + { + "id": "zeta", + "value": 0.125, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.1, + "maximum": 0.15 + } + } + }, + { + "id": "lambda", + "value": 0.034, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.027200000000000002, + "maximum": 0.0408 + } + } + }, + { + "id": "eta", + "value": 0.125, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.1, + "maximum": 0.15 + } + } + }, + { + "id": "rho", + "value": 0.034, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.027200000000000002, + "maximum": 0.0408 + } + } + }, + { + "id": "theta", + "value": 0.371, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.2968, + "maximum": 0.4452 + } + } + }, + { + "id": "kappa", + "value": 0.017, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.013600000000000001, + "maximum": 0.0204 + } + } + }, + { + "id": "mu", + "value": 0.017, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.013600000000000001, + "maximum": 0.0204 + } + } + }, + { + "id": "nu", + "value": 0.027, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.0216, + "maximum": 0.0324 + } + } + }, + { + "id": "xi", + "value": 0.017, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.013600000000000001, + "maximum": 0.0204 + } + } + }, + { + "id": "tau", + "value": 0.01, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.008, + "maximum": 0.012 + } + } + }, + { + "id": "sigma", + "value": 0.017, + "distribution": { + "type": "StandardUniform1", + "parameters": { + "minimum": 0.013600000000000001, + "maximum": 0.0204 + } + } + } + ], + "observables": [ + { + "id": "Cases", + "name": "Cases", + "expression": "Diagnosed + Recognized + Threatened", + "expression_mathml": "DiagnosedRecognizedThreatened" + }, + { + "id": "Hospitalizations", + "name": "Hospitalizations", + "expression": "Recognized + Threatened", + "expression_mathml": "RecognizedThreatened" + }, + { + "id": "Deaths", + "name": "Deaths", + "expression": "Extinct", + "expression_mathml": "Extinct" + } + ], + "time": { + "id": "t", + "units": { + "expression": "day", + "expression_mathml": "day" + } + } + } + }, + "metadata": { + "annotations": { + "license": "CC0", + "authors": [], + "references": [ + "pubmed:32322102" + ], + "time_scale": null, + "time_start": null, + "time_end": null, + "locations": [], + "pathogens": [ + "ncbitaxon:2697049" + ], + "diseases": [ + "doid:0080600" + ], + "hosts": [ + "ncbitaxon:9606" + ], + "model_types": [ + "mamo:0000028" + ] + } + } +} \ No newline at end of file diff --git a/examples/BIOMD0000000955_miranet.json b/examples/BIOMD0000000955_miranet.json deleted file mode 100644 index 9365197..0000000 --- a/examples/BIOMD0000000955_miranet.json +++ /dev/null @@ -1,523 +0,0 @@ -{ - "S": [ - { - "sname": "Susceptible", - "sprop": { - "is_observable": false, - "mira_ids": "[('identity', 'ido:0000514')]", - "mira_context": "[]", - "mira_concept": "{\"name\": \"Susceptible\", \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}" - }, - "concentration": 0.9999963 - }, - { - "sname": "Infected", - "sprop": { - "is_observable": false, - "mira_ids": "[('identity', 'ido:0000511')]", - "mira_context": "[]", - "mira_concept": "{\"name\": \"Infected\", \"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\", \"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\", \"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\", \"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\", \"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\", \"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\", \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}" - }, - "concentration": 0.0 - }, - { - "sname": "Cases", - "concentration": 0.0, - "sprop": { - "concept": "{\"name\": \"Cases\", \"mira_ids\": {}, \"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\": {}, \"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\": {}, \"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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"subject\": {\"name\": \"Susceptible\", \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Diagnosed*Susceptible*beta", - "mira_rate_law_mathml": "DiagnosedSusceptibleβ", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"subject\": {\"name\": \"Susceptible\", \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Ailing*Susceptible*gamma", - "mira_rate_law_mathml": "AilingSusceptibleγ", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"subject\": {\"name\": \"Susceptible\", \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Recognized*Susceptible*delta", - "mira_rate_law_mathml": "RecognizedSusceptibleδ", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"subject\": {\"name\": \"Susceptible\", \"identifiers\": {\"ido\": \"0000514\"}, \"context\": {}}, \"outcome\": {\"name\": \"Infected\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Infected*Susceptible*alpha", - "mira_rate_law_mathml": "InfectedSusceptibleα", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"outcome\": {\"name\": \"Diagnosed\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"provenance\": []}", - "mira_rate_law": "Infected*epsilon", - "mira_rate_law_mathml": "Infectedε", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"outcome\": {\"name\": \"Ailing\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"provenance\": []}", - "mira_rate_law": "Infected*zeta", - "mira_rate_law_mathml": "Infectedζ", - "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*XXlambdaXX\", \"type\": \"NaturalConversion\", \"subject\": {\"name\": \"Infected\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {}}, \"outcome\": {\"name\": \"Healed\", \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Infected*XXlambdaXX", - "mira_rate_law_mathml": "InfectedXXlambdaXX", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Recognized\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"provenance\": []}", - "mira_rate_law": "Diagnosed*eta", - "mira_rate_law_mathml": "Diagnosedη", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Healed\", \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Diagnosed*rho", - "mira_rate_law_mathml": "Diagnosedρ", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"outcome\": {\"name\": \"Recognized\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"provenance\": []}", - "mira_rate_law": "Ailing*theta", - "mira_rate_law_mathml": "Ailingθ", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"outcome\": {\"name\": \"Healed\", \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Ailing*kappa", - "mira_rate_law_mathml": "Ailingκ", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\"}}, \"outcome\": {\"name\": \"Threatened\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25467\"}}, \"provenance\": []}", - "mira_rate_law": "Ailing*mu", - "mira_rate_law_mathml": "Ailingμ", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Threatened\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25467\"}}, \"provenance\": []}", - "mira_rate_law": "Recognized*nu", - "mira_rate_law_mathml": "Recognizedν", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"diagnosis\": \"ncit:C15220\"}}, \"outcome\": {\"name\": \"Healed\", \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Recognized*xi", - "mira_rate_law_mathml": "Recognizedξ", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25467\"}}, \"outcome\": {\"name\": \"Extinct\", \"identifiers\": {\"ncit\": \"C28554\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Threatened*tau", - "mira_rate_law_mathml": "Threatenedτ", - "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\", \"identifiers\": {\"ido\": \"0000511\"}, \"context\": {\"disease_severity\": \"ncit:C25467\"}}, \"outcome\": {\"name\": \"Healed\", \"identifiers\": {\"ido\": \"0000592\"}, \"context\": {}}, \"provenance\": []}", - "mira_rate_law": "Threatened*sigma", - "mira_rate_law_mathml": "Threatenedσ", - "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/examples/example-model.json b/examples/example-model.json deleted file mode 100644 index a0d0c27..0000000 --- a/examples/example-model.json +++ /dev/null @@ -1 +0,0 @@ -{"T":[{"tname":"exp"},{"tname":"conv"},{"tname":"rec"},{"tname":"death"}],"S":[{"sname":"S"},{"sname":"E"},{"sname":"I"},{"sname":"R"},{"sname":"D"}],"I":[{"it":1,"is":1},{"it":1,"is":3},{"it":2,"is":2},{"it":3,"is":3},{"it":4,"is":3}],"O":[{"ot":1,"os":2},{"ot":1,"os":3},{"ot":2,"os":3},{"ot":3,"os":4},{"ot":4,"os":5}]} diff --git a/examples/request-calibrate-no-integration.json b/examples/request-calibrate-no-integration.json new file mode 100644 index 0000000..6552202 --- /dev/null +++ b/examples/request-calibrate-no-integration.json @@ -0,0 +1,8 @@ +{ + "model": "{\"name\": \"Giordano2020 - SIDARTHE model of COVID-19 spread in Italy\",\"schema\": \"https://raw.githubusercontent.com/DARPA-ASKEM/Model-Representations/petrinet_v0.5/petrinet/petrinet_schema.json\",\"schema_name\": \"petrinet\",\"description\": \"Giordano2020 - SIDARTHE model of COVID-19 spread in Italy\",\"model_version\": \"0.1\",\"properties\": {},\"model\": { \"states\": [ { \"id\": \"Susceptible\", \"name\": \"Susceptible\", \"grounding\": { \"identifiers\": { \"ido\": \"0000514\" }, \"modifiers\": {} }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Diagnosed\", \"name\": \"Diagnosed\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": { \"diagnosis\": \"ncit:C15220\" } }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Infected\", \"name\": \"Infected\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": {} }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Ailing\", \"name\": \"Ailing\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": { \"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\" } }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Recognized\", \"name\": \"Recognized\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": { \"diagnosis\": \"ncit:C15220\" } }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Healed\", \"name\": \"Healed\", \"grounding\": { \"identifiers\": { \"ido\": \"0000592\" }, \"modifiers\": {} }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Threatened\", \"name\": \"Threatened\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": { \"disease_severity\": \"ncit:C25467\" } }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Extinct\", \"name\": \"Extinct\", \"grounding\": { \"identifiers\": { \"ncit\": \"C28554\" }, \"modifiers\": {} }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } } ], \"transitions\": [ { \"id\": \"t1\", \"input\": [ \"Diagnosed\", \"Susceptible\" ], \"output\": [ \"Diagnosed\", \"Infected\" ], \"properties\": { \"name\": \"t1\" } }, { \"id\": \"t2\", \"input\": [ \"Ailing\", \"Susceptible\" ], \"output\": [ \"Ailing\", \"Infected\" ], \"properties\": { \"name\": \"t2\" } }, { \"id\": \"t3\", \"input\": [ \"Recognized\", \"Susceptible\" ], \"output\": [ \"Recognized\", \"Infected\" ], \"properties\": { \"name\": \"t3\" } }, { \"id\": \"t4\", \"input\": [ \"Infected\", \"Susceptible\" ], \"output\": [ \"Infected\", \"Infected\" ], \"properties\": { \"name\": \"t4\" } }, { \"id\": \"t5\", \"input\": [ \"Infected\" ], \"output\": [ \"Diagnosed\" ], \"properties\": { \"name\": \"t5\" } }, { \"id\": \"t6\", \"input\": [ \"Infected\" ], \"output\": [ \"Ailing\" ], \"properties\": { \"name\": \"t6\" } }, { \"id\": \"t7\", \"input\": [ \"Infected\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t7\" } }, { \"id\": \"t8\", \"input\": [ \"Diagnosed\" ], \"output\": [ \"Recognized\" ], \"properties\": { \"name\": \"t8\" } }, { \"id\": \"t9\", \"input\": [ \"Diagnosed\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t9\" } }, { \"id\": \"t10\", \"input\": [ \"Ailing\" ], \"output\": [ \"Recognized\" ], \"properties\": { \"name\": \"t10\" } }, { \"id\": \"t11\", \"input\": [ \"Ailing\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t11\" } }, { \"id\": \"t12\", \"input\": [ \"Ailing\" ], \"output\": [ \"Threatened\" ], \"properties\": { \"name\": \"t12\" } }, { \"id\": \"t13\", \"input\": [ \"Recognized\" ], \"output\": [ \"Threatened\" ], \"properties\": { \"name\": \"t13\" } }, { \"id\": \"t14\", \"input\": [ \"Recognized\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t14\" } }, { \"id\": \"t15\", \"input\": [ \"Threatened\" ], \"output\": [ \"Extinct\" ], \"properties\": { \"name\": \"t15\" } }, { \"id\": \"t16\", \"input\": [ \"Threatened\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t16\" } } ] }, \"semantics\": { \"ode\": { \"rates\": [ { \"target\": \"t1\", \"expression\": \"Diagnosed*Susceptible*beta\", \"expression_mathml\": \"DiagnosedSusceptiblebeta\" }, { \"target\": \"t2\", \"expression\": \"Ailing*Susceptible*gamma\", \"expression_mathml\": \"AilingSusceptiblegamma\" }, { \"target\": \"t3\", \"expression\": \"Recognized*Susceptible*delta\", \"expression_mathml\": \"RecognizedSusceptibledelta\" }, { \"target\": \"t4\", \"expression\": \"Infected*Susceptible*alpha\", \"expression_mathml\": \"InfectedSusceptiblealpha\" }, { \"target\": \"t5\", \"expression\": \"Infected*epsilon\", \"expression_mathml\": \"Infectedepsilon\" }, { \"target\": \"t6\", \"expression\": \"Infected*zeta\", \"expression_mathml\": \"Infectedzeta\" }, { \"target\": \"t7\", \"expression\": \"Infected*lambda\", \"expression_mathml\": \"Infectedlambda\" }, { \"target\": \"t8\", \"expression\": \"Diagnosed*eta\", \"expression_mathml\": \"Diagnosedeta\" }, { \"target\": \"t9\", \"expression\": \"Diagnosed*rho\", \"expression_mathml\": \"Diagnosedrho\" }, { \"target\": \"t10\", \"expression\": \"Ailing*theta\", \"expression_mathml\": \"Ailingtheta\" }, { \"target\": \"t11\", \"expression\": \"Ailing*kappa\", \"expression_mathml\": \"Ailingkappa\" }, { \"target\": \"t12\", \"expression\": \"Ailing*mu\", \"expression_mathml\": \"Ailingmu\" }, { \"target\": \"t13\", \"expression\": \"Recognized*nu\", \"expression_mathml\": \"Recognizednu\" }, { \"target\": \"t14\", \"expression\": \"Recognized*xi\", \"expression_mathml\": \"Recognizedxi\" }, { \"target\": \"t15\", \"expression\": \"Threatened*tau\", \"expression_mathml\": \"Threatenedtau\" }, { \"target\": \"t16\", \"expression\": \"Threatened*sigma\", \"expression_mathml\": \"Threatenedsigma\" } ], \"initials\": [ { \"target\": \"Susceptible\", \"expression\": \"0.999996300000000\", \"expression_mathml\": \"0.99999629999999995\" }, { \"target\": \"Diagnosed\", \"expression\": \"3.33333333000000e-7\", \"expression_mathml\": \"3.33333333e-7\" }, { \"target\": \"Infected\", \"expression\": \"3.33333333000000e-6\", \"expression_mathml\": \"3.3333333299999999e-6\" }, { \"target\": \"Ailing\", \"expression\": \"1.66666666000000e-8\", \"expression_mathml\": \"1.6666666599999999e-8\" }, { \"target\": \"Recognized\", \"expression\": \"3.33333333000000e-8\", \"expression_mathml\": \"3.33333333e-8\" }, { \"target\": \"Healed\", \"expression\": \"0.0\", \"expression_mathml\": \"0.0\" }, { \"target\": \"Threatened\", \"expression\": \"0.0\", \"expression_mathml\": \"0.0\" }, { \"target\": \"Extinct\", \"expression\": \"0.0\", \"expression_mathml\": \"0.0\" } ], \"parameters\": [ { \"id\": \"beta\", \"value\": 0.011, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.008799999999999999, \"maximum\": 0.0132 } } }, { \"id\": \"gamma\", \"value\": 0.456, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.3648, \"maximum\": 0.5472 } } }, { \"id\": \"delta\", \"value\": 0.011, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.008799999999999999, \"maximum\": 0.0132 } } }, { \"id\": \"alpha\", \"value\": 0.57, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.45599999999999996, \"maximum\": 0.6839999999999999 } } }, { \"id\": \"epsilon\", \"value\": 0.171, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.1368, \"maximum\": 0.20520000000000002 } } }, { \"id\": \"zeta\", \"value\": 0.125, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.1, \"maximum\": 0.15 } } }, { \"id\": \"lambda\", \"value\": 0.034, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.027200000000000002, \"maximum\": 0.0408 } } }, { \"id\": \"eta\", \"value\": 0.125, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.1, \"maximum\": 0.15 } } }, { \"id\": \"rho\", \"value\": 0.034, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.027200000000000002, \"maximum\": 0.0408 } } }, { \"id\": \"theta\", \"value\": 0.371, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.2968, \"maximum\": 0.4452 } } }, { \"id\": \"kappa\", \"value\": 0.017, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.013600000000000001, \"maximum\": 0.0204 } } }, { \"id\": \"mu\", \"value\": 0.017, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.013600000000000001, \"maximum\": 0.0204 } } }, { \"id\": \"nu\", \"value\": 0.027, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.0216, \"maximum\": 0.0324 } } }, { \"id\": \"xi\", \"value\": 0.017, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.013600000000000001, \"maximum\": 0.0204 } } }, { \"id\": \"tau\", \"value\": 0.01, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.008, \"maximum\": 0.012 } } }, { \"id\": \"sigma\", \"value\": 0.017, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.013600000000000001, \"maximum\": 0.0204 } } } ], \"observables\": [ { \"id\": \"Cases\", \"name\": \"Cases\", \"expression\": \"Diagnosed + Recognized + Threatened\", \"expression_mathml\": \"DiagnosedRecognizedThreatened\" }, { \"id\": \"Hospitalizations\", \"name\": \"Hospitalizations\", \"expression\": \"Recognized + Threatened\", \"expression_mathml\": \"RecognizedThreatened\" }, { \"id\": \"Deaths\", \"name\": \"Deaths\", \"expression\": \"Extinct\", \"expression_mathml\": \"Extinct\" } ], \"time\": { \"id\": \"t\", \"units\": { \"expression\": \"day\", \"expression_mathml\": \"day\" } } } }, \"metadata\": { \"annotations\": { \"license\": \"CC0\", \"authors\": [], \"references\": [ \"pubmed:32322102\" ], \"time_scale\": null, \"time_start\": null, \"time_end\": null, \"locations\": [], \"pathogens\": [ \"ncbitaxon:2697049\" ], \"diseases\": [ \"doid:0080600\" ], \"hosts\": [ \"ncbitaxon:9606\" ], \"model_types\": [ \"mamo:0000028\" ] } }}", + "dataset": { + "id": "2ea2d39f-866f-46f6-beec-972ed2136ed5", + "filename": "dataset.csv" + }, + "timespan": {"start": 101, "end": 190} +} diff --git a/examples/request-calibrate.json b/examples/request-calibrate.json deleted file mode 100644 index 53eb17a..0000000 --- a/examples/request-calibrate.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "model_config_id": "f20ea672-bfa4-422b-884f-0a4c09356fd0", - "dataset": { - "id": "2ea2d39f-866f-46f6-beec-972ed2136ed5", - "filename": "dataset.csv" - }, - "timespan": {"start": 101, "end": 190}, - "extra": { - "initials": { - "S": 0.49457800495224524, - "E": 0.26745259325403603, - "I": 0.4497387877393193, - "R": 0.32807705995998604, - "D": 0.8545934885162726 - }, - "params": { - "exp": 0.16207166221196045, - "conv": 0.7009195813964052, - "rec": 0.7040317196117394, - "death": 0.15807853921067516 - } - } -} diff --git a/examples/request-simulate.json b/examples/request-simulate-integrated.json similarity index 100% rename from examples/request-simulate.json rename to examples/request-simulate-integrated.json diff --git a/examples/request-simulate-no-integration.json b/examples/request-simulate-no-integration.json new file mode 100644 index 0000000..7b60e7e --- /dev/null +++ b/examples/request-simulate-no-integration.json @@ -0,0 +1,4 @@ +{ + "model": "{\"name\": \"Giordano2020 - SIDARTHE model of COVID-19 spread in Italy\",\"schema\": \"https://raw.githubusercontent.com/DARPA-ASKEM/Model-Representations/petrinet_v0.5/petrinet/petrinet_schema.json\",\"schema_name\": \"petrinet\",\"description\": \"Giordano2020 - SIDARTHE model of COVID-19 spread in Italy\",\"model_version\": \"0.1\",\"properties\": {},\"model\": { \"states\": [ { \"id\": \"Susceptible\", \"name\": \"Susceptible\", \"grounding\": { \"identifiers\": { \"ido\": \"0000514\" }, \"modifiers\": {} }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Diagnosed\", \"name\": \"Diagnosed\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": { \"diagnosis\": \"ncit:C15220\" } }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Infected\", \"name\": \"Infected\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": {} }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Ailing\", \"name\": \"Ailing\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": { \"disease_severity\": \"ncit:C25269\", \"diagnosis\": \"ncit:C113725\" } }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Recognized\", \"name\": \"Recognized\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": { \"diagnosis\": \"ncit:C15220\" } }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Healed\", \"name\": \"Healed\", \"grounding\": { \"identifiers\": { \"ido\": \"0000592\" }, \"modifiers\": {} }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Threatened\", \"name\": \"Threatened\", \"grounding\": { \"identifiers\": { \"ido\": \"0000511\" }, \"modifiers\": { \"disease_severity\": \"ncit:C25467\" } }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } }, { \"id\": \"Extinct\", \"name\": \"Extinct\", \"grounding\": { \"identifiers\": { \"ncit\": \"C28554\" }, \"modifiers\": {} }, \"units\": { \"expression\": \"1\", \"expression_mathml\": \"1\" } } ], \"transitions\": [ { \"id\": \"t1\", \"input\": [ \"Diagnosed\", \"Susceptible\" ], \"output\": [ \"Diagnosed\", \"Infected\" ], \"properties\": { \"name\": \"t1\" } }, { \"id\": \"t2\", \"input\": [ \"Ailing\", \"Susceptible\" ], \"output\": [ \"Ailing\", \"Infected\" ], \"properties\": { \"name\": \"t2\" } }, { \"id\": \"t3\", \"input\": [ \"Recognized\", \"Susceptible\" ], \"output\": [ \"Recognized\", \"Infected\" ], \"properties\": { \"name\": \"t3\" } }, { \"id\": \"t4\", \"input\": [ \"Infected\", \"Susceptible\" ], \"output\": [ \"Infected\", \"Infected\" ], \"properties\": { \"name\": \"t4\" } }, { \"id\": \"t5\", \"input\": [ \"Infected\" ], \"output\": [ \"Diagnosed\" ], \"properties\": { \"name\": \"t5\" } }, { \"id\": \"t6\", \"input\": [ \"Infected\" ], \"output\": [ \"Ailing\" ], \"properties\": { \"name\": \"t6\" } }, { \"id\": \"t7\", \"input\": [ \"Infected\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t7\" } }, { \"id\": \"t8\", \"input\": [ \"Diagnosed\" ], \"output\": [ \"Recognized\" ], \"properties\": { \"name\": \"t8\" } }, { \"id\": \"t9\", \"input\": [ \"Diagnosed\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t9\" } }, { \"id\": \"t10\", \"input\": [ \"Ailing\" ], \"output\": [ \"Recognized\" ], \"properties\": { \"name\": \"t10\" } }, { \"id\": \"t11\", \"input\": [ \"Ailing\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t11\" } }, { \"id\": \"t12\", \"input\": [ \"Ailing\" ], \"output\": [ \"Threatened\" ], \"properties\": { \"name\": \"t12\" } }, { \"id\": \"t13\", \"input\": [ \"Recognized\" ], \"output\": [ \"Threatened\" ], \"properties\": { \"name\": \"t13\" } }, { \"id\": \"t14\", \"input\": [ \"Recognized\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t14\" } }, { \"id\": \"t15\", \"input\": [ \"Threatened\" ], \"output\": [ \"Extinct\" ], \"properties\": { \"name\": \"t15\" } }, { \"id\": \"t16\", \"input\": [ \"Threatened\" ], \"output\": [ \"Healed\" ], \"properties\": { \"name\": \"t16\" } } ] }, \"semantics\": { \"ode\": { \"rates\": [ { \"target\": \"t1\", \"expression\": \"Diagnosed*Susceptible*beta\", \"expression_mathml\": \"DiagnosedSusceptiblebeta\" }, { \"target\": \"t2\", \"expression\": \"Ailing*Susceptible*gamma\", \"expression_mathml\": \"AilingSusceptiblegamma\" }, { \"target\": \"t3\", \"expression\": \"Recognized*Susceptible*delta\", \"expression_mathml\": \"RecognizedSusceptibledelta\" }, { \"target\": \"t4\", \"expression\": \"Infected*Susceptible*alpha\", \"expression_mathml\": \"InfectedSusceptiblealpha\" }, { \"target\": \"t5\", \"expression\": \"Infected*epsilon\", \"expression_mathml\": \"Infectedepsilon\" }, { \"target\": \"t6\", \"expression\": \"Infected*zeta\", \"expression_mathml\": \"Infectedzeta\" }, { \"target\": \"t7\", \"expression\": \"Infected*lambda\", \"expression_mathml\": \"Infectedlambda\" }, { \"target\": \"t8\", \"expression\": \"Diagnosed*eta\", \"expression_mathml\": \"Diagnosedeta\" }, { \"target\": \"t9\", \"expression\": \"Diagnosed*rho\", \"expression_mathml\": \"Diagnosedrho\" }, { \"target\": \"t10\", \"expression\": \"Ailing*theta\", \"expression_mathml\": \"Ailingtheta\" }, { \"target\": \"t11\", \"expression\": \"Ailing*kappa\", \"expression_mathml\": \"Ailingkappa\" }, { \"target\": \"t12\", \"expression\": \"Ailing*mu\", \"expression_mathml\": \"Ailingmu\" }, { \"target\": \"t13\", \"expression\": \"Recognized*nu\", \"expression_mathml\": \"Recognizednu\" }, { \"target\": \"t14\", \"expression\": \"Recognized*xi\", \"expression_mathml\": \"Recognizedxi\" }, { \"target\": \"t15\", \"expression\": \"Threatened*tau\", \"expression_mathml\": \"Threatenedtau\" }, { \"target\": \"t16\", \"expression\": \"Threatened*sigma\", \"expression_mathml\": \"Threatenedsigma\" } ], \"initials\": [ { \"target\": \"Susceptible\", \"expression\": \"0.999996300000000\", \"expression_mathml\": \"0.99999629999999995\" }, { \"target\": \"Diagnosed\", \"expression\": \"3.33333333000000e-7\", \"expression_mathml\": \"3.33333333e-7\" }, { \"target\": \"Infected\", \"expression\": \"3.33333333000000e-6\", \"expression_mathml\": \"3.3333333299999999e-6\" }, { \"target\": \"Ailing\", \"expression\": \"1.66666666000000e-8\", \"expression_mathml\": \"1.6666666599999999e-8\" }, { \"target\": \"Recognized\", \"expression\": \"3.33333333000000e-8\", \"expression_mathml\": \"3.33333333e-8\" }, { \"target\": \"Healed\", \"expression\": \"0.0\", \"expression_mathml\": \"0.0\" }, { \"target\": \"Threatened\", \"expression\": \"0.0\", \"expression_mathml\": \"0.0\" }, { \"target\": \"Extinct\", \"expression\": \"0.0\", \"expression_mathml\": \"0.0\" } ], \"parameters\": [ { \"id\": \"beta\", \"value\": 0.011, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.008799999999999999, \"maximum\": 0.0132 } } }, { \"id\": \"gamma\", \"value\": 0.456, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.3648, \"maximum\": 0.5472 } } }, { \"id\": \"delta\", \"value\": 0.011, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.008799999999999999, \"maximum\": 0.0132 } } }, { \"id\": \"alpha\", \"value\": 0.57, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.45599999999999996, \"maximum\": 0.6839999999999999 } } }, { \"id\": \"epsilon\", \"value\": 0.171, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.1368, \"maximum\": 0.20520000000000002 } } }, { \"id\": \"zeta\", \"value\": 0.125, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.1, \"maximum\": 0.15 } } }, { \"id\": \"lambda\", \"value\": 0.034, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.027200000000000002, \"maximum\": 0.0408 } } }, { \"id\": \"eta\", \"value\": 0.125, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.1, \"maximum\": 0.15 } } }, { \"id\": \"rho\", \"value\": 0.034, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.027200000000000002, \"maximum\": 0.0408 } } }, { \"id\": \"theta\", \"value\": 0.371, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.2968, \"maximum\": 0.4452 } } }, { \"id\": \"kappa\", \"value\": 0.017, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.013600000000000001, \"maximum\": 0.0204 } } }, { \"id\": \"mu\", \"value\": 0.017, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.013600000000000001, \"maximum\": 0.0204 } } }, { \"id\": \"nu\", \"value\": 0.027, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.0216, \"maximum\": 0.0324 } } }, { \"id\": \"xi\", \"value\": 0.017, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.013600000000000001, \"maximum\": 0.0204 } } }, { \"id\": \"tau\", \"value\": 0.01, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.008, \"maximum\": 0.012 } } }, { \"id\": \"sigma\", \"value\": 0.017, \"distribution\": { \"type\": \"StandardUniform1\", \"parameters\": { \"minimum\": 0.013600000000000001, \"maximum\": 0.0204 } } } ], \"observables\": [ { \"id\": \"Cases\", \"name\": \"Cases\", \"expression\": \"Diagnosed + Recognized + Threatened\", \"expression_mathml\": \"DiagnosedRecognizedThreatened\" }, { \"id\": \"Hospitalizations\", \"name\": \"Hospitalizations\", \"expression\": \"Recognized + Threatened\", \"expression_mathml\": \"RecognizedThreatened\" }, { \"id\": \"Deaths\", \"name\": \"Deaths\", \"expression\": \"Extinct\", \"expression_mathml\": \"Extinct\" } ], \"time\": { \"id\": \"t\", \"units\": { \"expression\": \"day\", \"expression_mathml\": \"day\" } } } }, \"metadata\": { \"annotations\": { \"license\": \"CC0\", \"authors\": [], \"references\": [ \"pubmed:32322102\" ], \"time_scale\": null, \"time_start\": null, \"time_end\": null, \"locations\": [], \"pathogens\": [ \"ncbitaxon:2697049\" ], \"diseases\": [ \"doid:0080600\" ], \"hosts\": [ \"ncbitaxon:9606\" ], \"model_types\": [ \"mamo:0000028\" ] } }}", + "timespan": {"start": 0, "end": 90} +} diff --git a/paths.yaml b/paths.yaml index f7ab5e2..c0bb6da 100644 --- a/paths.yaml +++ b/paths.yaml @@ -11,8 +11,8 @@ properties: engine: type: string - enum: [SciML, CIEMSS] - example: CIEMSS + enum: [sciml, ciemss] + example: sciml model_config_id: type: string example: "ba8da8d4-047d-11ee-be56" @@ -61,8 +61,8 @@ properties: engine: type: string - enum: [SciML, CIEMSS] - example: CIEMSS + enum: [sciml, ciemss] + example: sciml model_config_id: type: string example: "c1cd941a-047d-11ee-be56" @@ -117,8 +117,8 @@ properties: engine: type: string - enum: [SciML, CIEMSS] - example: CIEMSS + enum: [sciml, ciemss] + example: sciml model_config_ids: type: array items: diff --git a/src/operations/Operations.jl b/src/operations/Operations.jl index 865e840..8b4b354 100644 --- a/src/operations/Operations.jl +++ b/src/operations/Operations.jl @@ -83,8 +83,8 @@ function (o::IntermediateResults)(integrator) if isnothing(o.context) @info "IntermediateResults: $(NamedTuple(d))" else - d[:job_id] = context.job_id - context.interactivity_hook(d) + d[:job_id] = o.context.job_id + o.context.interactivity_hook(d) end end end diff --git a/src/service/ArgIO.jl b/src/service/ArgIO.jl index fc3feb0..8690e94 100644 --- a/src/service/ArgIO.jl +++ b/src/service/ArgIO.jl @@ -31,7 +31,13 @@ function prepare_input(args; context...) args[:model] = fetch_model(args[:model_config_id]) end if in(:dataset, keys(args)) && !isa(args[:dataset], String) - args[:dataset] = fetch_dataset(args[:dataset]["id"], args[:dataset]["filename"], get(args[:dataset], "mappings", Dict())) + if !isa(args[:dataset], String) + args[:dataset] = fetch_dataset(args[:dataset]["id"], args[:dataset]["filename"], get(args[:dataset], "mappings", Dict())) + else + io = IOBuffer(args[:dataset]) + seekstart(io) + args[:dataset] = CSV.read(io, DataFrame) + end end if in(:model_config_ids, keys(args)) args[:models] = fetch_model.(map(string, args[:model_ids])) @@ -82,6 +88,8 @@ function prepare_output(params::Vector{Pair{Symbolics.Num, Float64}}; name="0", fixed_params = Dict(key => nan_to_nothing(value) for (key, value) in params) if settings["ENABLE_TDS"] return upload(fixed_params, context[:job_id]; name=name) + else + params end end @@ -90,12 +98,14 @@ end # Coerces NaN values to nothing for each parameter # """ function prepare_output(results::Dict{String}; context...) + prepared_outputs = [] + for (name, value) in results + append!(prepared_outputs, [prepare_output(value; context..., name=name)]) + end if settings["ENABLE_TDS"] - urls = [] - for (name, value) in results - append!(urls, [prepare_output(value; context..., name=name)]) - end - update_simulation(context[:job_id], Dict([:status => "complete", :result_files => urls, :completed_time => time()])) + update_simulation(context[:job_id], Dict([:status => "complete", :result_files => prepared_outputs, :completed_time => time()])) + else + results end end diff --git a/src/service/Execution.jl b/src/service/Execution.jl index be9e3a0..acf7a9f 100644 --- a/src/service/Execution.jl +++ b/src/service/Execution.jl @@ -36,15 +36,18 @@ function contextualize_prog(context) if settings["ENABLE_TDS"] update_simulation(context.job_id, Dict([:status=>"error"])) end - throw(exception) + rethrow(exception) end end end +# Coerce request object to dict +make_deterministic_run(req::Request, operation::String) = make_deterministic_run(json(req, Dict{Symbol, Any}), operation) + """ Schedule a sim run given an operation """ -function make_deterministic_run(req::Request, operation::String) +function make_deterministic_run(args, operation::String) # TODO(five): Spawn remote workers and run jobs on them if !in(operation, keys(available_operations)) return Response( @@ -56,7 +59,6 @@ function make_deterministic_run(req::Request, operation::String) publish_hook = settings["RABBITMQ_ENABLED"] ? publish_to_rabbitmq : (_...) -> nothing - args = json(req, Dict{Symbol,Any}) context = Context( generate_id(), publish_hook,