COVID Full Model

using StockFlow
using StockFlow.Syntax

using Catlab
using Catlab.CategoricalAlgebra
using LabelledArrays
using OrdinaryDiffEq
using Plots

using Catlab.Graphics
using Catlab.Programs
using Catlab.WiringDiagrams

display_uwd(ex) = to_graphviz(ex, box_labels=:name, junction_labels=:variable, edge_attrs=Dict(:len=>"1"));

seir = @stock_and_flow begin

    :stocks
    S
    E
    IA
    IYU
    IYN
    R

    :parameters
    β
    rLatent
    rIncubation
    rDevelop
    rRecovery
    rw

    :dynamic_variables
    v_NewIncidence₁ = β * NIC
    v_NewIncidence₂ = v_NewIncidence₁ / N # λ
    v_NewIncidence₃ = v_NewIncidence₂ * S


    v_NewInfectious = E * rLatent
    v_BecomingSymptomatic = IA * rIncubation
    v_SymptomicsNotDevelopingComplications = IYU * rDevelop
    v_NewRecovery = IYN * rRecovery
    v_WaningImmunityR = R * rw

    :flows
    S => fNewIncidence(v_NewIncidence₃) => E
    E => fNewInfectious(v_NewInfectious) => IA
    IA => fBecomingSymptomatic(v_BecomingSymptomatic) => IYU
    IYU => fSymptomicsNotDevelopingComplications(v_SymptomicsNotDevelopingComplications) => IYN
    IYN => fNewRecovery(v_NewRecovery) => R
    R => fWaningImmunityR(v_WaningImmunityR) => S



    :sums
    N = [S, E, IA, IYU, IYN, R]
    NIC = [IA, IYU, IYN]
    NI = [IA, IYU, IYN]

end


GraphF(seir)

v = @stock_and_flow begin
    :stocks
    S
    E
    VP
    VF


    :parameters
    rv
    rw
    λ
    eP_complement # 1.0 - eP
    eF_complement # 1.0 - eF


    :dynamic_variables
    v_NewIncidenceVP = VP * eP_complement
    v_NewIncidenceVF = VF * eF_complement

    v_infVP = v_NewIncidenceVP * λ
    v_infVF = v_NewIncidenceVF * λ


    :flows
    S => fFirstdoseVaccine(S * rv) => VP
    VP => fWaningImmunityVP(VP * rw) => S
    VP => fSeconddoseVaccine(VP * rv) => VF
    VF => fWaningImmunityVF(VF * rw) => VP
    VP => fNewIncidenceVP(v_infVP) => E
    VF => fNewIncidenceVF(v_infVF) => E



    :sums
    N = [S, E, VP, VF]
    NIC = []
end

GraphF(v;rd="TB")

ia = @stock_and_flow begin
    :stocks
    IA
    IA2
    IA3
    R

    :parameters
    rIncubationIA
    rDevelopIA2
    rRecoveryIA3

    :flows
    IA => fDevelopmentOfPersistentAsymptomaticity(IA * rIncubationIA) => IA2
    IA2 => fProgressionIA2_IA3(IA2 * rDevelopIA2) => IA3
    IA3 => fNewrecoveryIA3(IA3 * rRecoveryIA3) => R

    :sums
    N = [IA, IA2, IA3, R]
    NIC = [IA, IA2, IA3]
    NI = [IA, IA2, IA3]
end

GraphF(ia)

h = @stock_and_flow begin
    :stocks
     IYU
     HICU
     HNICU
     R
     D

     :parameters
     rAdmICU
     rAdmNICU
     rOutICU
     rrH
     rDeathICU
     rDeathNICU

     :dynamic_variables
     v_HICUAdmission = IYU * rAdmICU
     v_HNICUAdmission = IYU * rAdmNICU
     v_OutICU = HICU * rOutICU
     v_RecoveryH = HNICU * rrH
     v_NewDeathsHICU = HICU * rDeathICU
     v_NewDeathsHNICU = HNICU * rDeathNICU

     :flows
     IYU => f_HICUAdmission(v_HICUAdmission) => HICU
     IYU => f_HNICUAdmission(v_HNICUAdmission) => HNICU
     HICU => f_OutICU(v_OutICU) => HNICU
     HNICU => f_RecoveryH(v_RecoveryH) => R
     HICU => f_NewDeathsHICU(v_NewDeathsHICU) => D
     HNICU => f_NewDeathsHNICU(v_NewDeathsHNICU) => D

     :sums
     N = [IYU, HICU, HNICU, R]
     NIC = [IYU]
     NI = [IYU, HICU, HNICU]


 end

GraphF(h;rd="TB")

footIYUN=foot(:IYU, (:NI,:NIC,:N), (:IYU=>:NI, :IYU=>:NIC, :IYU=>:N))
GraphF(footIYUN;schema="C0")

footRN=foot(:R, :N, :R=>:N)
GraphF(footRN;schema="C0")


footIAN=foot(:IA, (:NI,:NIC,:N), (:IA=>:NI, :IA=>:NIC, :IA=>:N))
GraphF(footIAN;schema="C0")

footSN=foot(:S, :N, :S=>:N)
GraphF(footSN;schema="C0")

footEN=foot(:E, :N, :E=>:N)
GraphF(footEN;schema="C0")

footNIC=foot((),:NIC,())
GraphF(footNIC;schema="C0")

covid = @relation (footSN, footEN, footIAN, footIYUN, footRN, footNIC) begin
    modelA(footSN, footEN, footIAN, footIYUN, footRN, footNIC)
    modelB(footSN, footEN, footNIC)
    modelC(footIAN, footRN)
    modelD(footIYUN, footRN)
end;
display_uwd(covid)

open_modelA=Open(seir, footSN, footEN, footIAN, footIYUN, footRN, footNIC)
open_modelB=Open(v,footSN,footEN, footNIC)
open_modelC=Open(ia,footIAN,footRN)
open_modelD=Open(h,footIYUN,footRN)
Catlab.CategoricalAlgebra.StructuredCospans.StructuredCospan{Catlab.CategoricalAlgebra.StructuredCospans.DiscreteACSet{StockAndFlow0, StockAndFlowF}, Catlab.CategoricalAlgebra.FreeDiagrams.Multicospan{StockAndFlowF, Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}, StaticArraysCore.SVector{2, Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}}}, StaticArraysCore.SVector{2, StockAndFlow0}}(Catlab.CategoricalAlgebra.FreeDiagrams.Multicospan{StockAndFlowF, Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}, StaticArraysCore.SVector{2, Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}}}(StockAndFlowF:
  S = 1:5
  SV = 1:3
  LS = 1:8
  F = 1:6
  I = 1:6
  O = 1:6
  V = 1:6
  LV = 1:6
  LSV = 1:0
  P = 1:6
  LVV = 1:0
  LPV = 1:6
  Name = 1:0
  Op = 1:0
  Position = 1:0
  lss : LS → S = [1, 1, 1, 2, 2, 3, 3, 4]
  lssv : LS → SV = [1, 2, 3, 1, 3, 1, 3, 1]
  ifn : I → F = [1, 2, 3, 4, 5, 6]
  is : I → S = [2, 3, 3, 4, 5, 5]
  ofn : O → F = [1, 2, 3, 5, 4, 6]
  os : O → S = [1, 1, 2, 2, 3, 3]
  fv : F → V = [1, 2, 3, 4, 5, 6]
  lvs : LV → S = [1, 1, 2, 3, 2, 3]
  lvv : LV → V = [1, 2, 3, 4, 5, 6]
  lsvsv : LSV → SV = Int64[]
  lsvv : LSV → V = Int64[]
  lvsrc : LVV → V = Int64[]
  lvtgt : LVV → V = Int64[]
  lpvp : LPV → P = [1, 2, 3, 4, 5, 6]
  lpvv : LPV → V = [1, 2, 3, 4, 5, 6]
  sname : S → Name = [:IYU, :HICU, :HNICU, :R, :D]
  svname : SV → Name = [:N, :NIC, :NI]
  fname : F → Name = [:f_HICUAdmission, :f_HNICUAdmission, :f_OutICU, :f_RecoveryH, :f_NewDeathsHICU, :f_NewDeathsHNICU]
  vname : V → Name = [:v_HICUAdmission, :v_HNICUAdmission, :v_OutICU, :v_RecoveryH, :v_NewDeathsHICU, :v_NewDeathsHNICU]
  pname : P → Name = [:rAdmICU, :rAdmNICU, :rOutICU, :rrH, :rDeathICU, :rDeathNICU]
  vop : V → Op = [:*, :*, :*, :*, :*, :*]
  lvsposition : LV → Position = Int8[1, 1, 1, 1, 1, 1]
  lsvsvposition : LSV → Position = Int8[]
  lvsrcposition : LVV → Position = Int8[]
  lpvpposition : LPV → Position = Int8[2, 2, 2, 2, 2, 2], Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}[ACSetTransformation((S = FinFunction([1], 1, 5), SV = FinFunction([3, 2, 1], 3, 3), LS = FinFunction([3, 2, 1], 3, 8), F = FinFunction(Int64[], 0, 6), I = FinFunction(Int64[], 0, 6), O = FinFunction(Int64[], 0, 6), V = FinFunction(Int64[], 0, 6), LV = FinFunction(Int64[], 0, 6), LSV = FinFunction(Int64[], 0, 0), P = FinFunction(Int64[], 0, 6), LVV = FinFunction(Int64[], 0, 0), LPV = FinFunction(Int64[], 0, 6), Name = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Op = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Position = Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Int8}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Int8})), FinSet(0))), StockAndFlowF {S:1, SV:3, LS:3, F:0, I:0, O:0, V:0, LV:0, LSV:0, P:0, LVV:0, LPV:0, Name:0, Op:0, Position:0}, StockAndFlowF {S:5, SV:3, LS:8, F:6, I:6, O:6, V:6, LV:6, LSV:0, P:6, LVV:0, LPV:6, Name:0, Op:0, Position:0}), ACSetTransformation((S = FinFunction([4], 1, 5), SV = FinFunction([1], 1, 3), LS = FinFunction([8], 1, 8), F = FinFunction(Int64[], 0, 6), I = FinFunction(Int64[], 0, 6), O = FinFunction(Int64[], 0, 6), V = FinFunction(Int64[], 0, 6), LV = FinFunction(Int64[], 0, 6), LSV = FinFunction(Int64[], 0, 0), P = FinFunction(Int64[], 0, 6), LVV = FinFunction(Int64[], 0, 0), LPV = FinFunction(Int64[], 0, 6), Name = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Op = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Position = Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Int8}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Int8})), FinSet(0))), StockAndFlowF {S:1, SV:1, LS:1, F:0, I:0, O:0, V:0, LV:0, LSV:0, P:0, LVV:0, LPV:0, Name:0, Op:0, Position:0}, StockAndFlowF {S:5, SV:3, LS:8, F:6, I:6, O:6, V:6, LV:6, LSV:0, P:6, LVV:0, LPV:6, Name:0, Op:0, Position:0})]), StockAndFlow0[StockAndFlow0:
  S = 1:1
  SV = 1:3
  LS = 1:3
  Name = 1:0
  lss : LS → S = [1, 1, 1]
  lssv : LS → SV = [1, 2, 3]
  sname : S → Name = [:IYU]
  svname : SV → Name = [:NI, :NIC, :N], StockAndFlow0:
  S = 1:1
  SV = 1:1
  LS = 1:1
  Name = 1:0
  lss : LS → S = [1]
  lssv : LS → SV = [1]
  sname : S → Name = [:R]
  svname : SV → Name = [:N]])

Compose those three models according the UWD-algebra

openCOVID19 = oapply(covid, [open_modelA, open_modelB, open_modelC, open_modelD])
Catlab.CategoricalAlgebra.StructuredCospans.StructuredMulticospan{Catlab.CategoricalAlgebra.StructuredCospans.DiscreteACSet{StockAndFlow0, StockAndFlowF}, Catlab.CategoricalAlgebra.FreeDiagrams.Multicospan{StockAndFlowF, Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}, Vector{Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}}}, Vector{Union{Nothing, StockAndFlow0}}}(Catlab.CategoricalAlgebra.FreeDiagrams.Multicospan{StockAndFlowF, Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}, Vector{Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}}}(StockAndFlowF:
  S = 1:13
  SV = 1:3
  LS = 1:24
  F = 1:21
  I = 1:21
  O = 1:21
  V = 1:25
  LV = 1:21
  LSV = 1:2
  P = 1:20
  LVV = 1:4
  LPV = 1:23
  Name = 1:0
  Op = 1:0
  Position = 1:0
  lss : LS → S = [1, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 7, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12]
  lssv : LS → SV = [1, 1, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 1, 1, 1, 2, 3, 1, 2, 3, 1, 3, 1, 3]
  ifn : I → F = [6, 1, 2, 3, 4, 5, 8, 11, 12, 7, 10, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21]
  is : I → S = [1, 2, 3, 4, 5, 6, 1, 2, 2, 7, 7, 8, 9, 10, 6, 11, 12, 12, 6, 13, 13]
  ofn : O → F = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10, 12, 13, 14, 15, 16, 17, 18, 20, 19, 21]
  os : O → S = [1, 2, 3, 4, 5, 6, 1, 7, 7, 7, 8, 8, 3, 9, 10, 4, 4, 11, 11, 12, 12]
  fv : F → V = [3, 4, 5, 6, 7, 8, 13, 14, 15, 16, 11, 12, 17, 18, 19, 20, 21, 22, 23, 24, 25]
  lvs : LV → S = [1, 2, 3, 4, 5, 6, 7, 8, 1, 7, 7, 8, 3, 9, 10, 4, 4, 11, 12, 11, 12]
  lvv : LV → V = [3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
  lsvsv : LSV → SV = [2, 1]
  lsvv : LSV → V = [1, 2]
  lvsrc : LVV → V = [1, 2, 9, 10]
  lvtgt : LVV → V = [2, 3, 11, 12]
  lpvp : LPV → P = [1, 2, 3, 4, 5, 6, 10, 11, 9, 9, 7, 8, 7, 8, 12, 13, 14, 15, 16, 17, 18, 19, 20]
  lpvv : LPV → V = [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
  sname : S → Name = [:S, :E, :IA, :IYU, :IYN, :R, :VP, :VF, :IA2, :IA3, :HICU, :HNICU, :D]
  svname : SV → Name = [:N, :NIC, :NI]
  fname : F → Name = [:fNewIncidence, :fNewInfectious, :fBecomingSymptomatic, :fSymptomicsNotDevelopingComplications, :fNewRecovery, :fWaningImmunityR, :fFirstdoseVaccine, :fWaningImmunityVP, :fSeconddoseVaccine, :fWaningImmunityVF, :fNewIncidenceVP, :fNewIncidenceVF, :fDevelopmentOfPersistentAsymptomaticity, :fProgressionIA2_IA3, :fNewrecoveryIA3, :f_HICUAdmission, :f_HNICUAdmission, :f_OutICU, :f_RecoveryH, :f_NewDeathsHICU, :f_NewDeathsHNICU]
  vname : V → Name = [:v_NewIncidence₁, :v_NewIncidence₂, :v_NewIncidence₃, :v_NewInfectious, :v_BecomingSymptomatic, :v_SymptomicsNotDevelopingComplications, :v_NewRecovery, :v_WaningImmunityR, :v_NewIncidenceVP, :v_NewIncidenceVF, :v_infVP, :v_infVF, Symbol("##v_fFirstdoseVaccine#605"), Symbol("##v_fWaningImmunityVP#606"), Symbol("##v_fSeconddoseVaccine#607"), Symbol("##v_fWaningImmunityVF#608"), Symbol("##v_fDevelopmentOfPersistentAsymptomaticity#609"), Symbol("##v_fProgressionIA2_IA3#610"), Symbol("##v_fNewrecoveryIA3#611"), :v_HICUAdmission, :v_HNICUAdmission, :v_OutICU, :v_RecoveryH, :v_NewDeathsHICU, :v_NewDeathsHNICU]
  pname : P → Name = [:β, :rLatent, :rIncubation, :rDevelop, :rRecovery, :rw, :rv, :rw, :λ, :eP_complement, :eF_complement, :rIncubationIA, :rDevelopIA2, :rRecoveryIA3, :rAdmICU, :rAdmNICU, :rOutICU, :rrH, :rDeathICU, :rDeathNICU]
  vop : V → Op = [:*, :/, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*, :*]
  lvsposition : LV → Position = Int8[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
  lsvsvposition : LSV → Position = Int8[2, 2]
  lvsrcposition : LVV → Position = Int8[1, 1, 1, 1]
  lpvpposition : LPV → Position = Int8[1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], Catlab.CategoricalAlgebra.CSets.StructTightACSetTransformation{ACSets.Schemas.TypeLevelBasicSchema{Symbol, Tuple{:S, :SV, :LS, :F, :I, :O, :V, :LV, :LSV, :P, :LVV, :LPV}, Tuple{(:lss, :LS, :S), (:lssv, :LS, :SV), (:ifn, :I, :F), (:is, :I, :S), (:ofn, :O, :F), (:os, :O, :S), (:fv, :F, :V), (:lvs, :LV, :S), (:lvv, :LV, :V), (:lsvsv, :LSV, :SV), (:lsvv, :LSV, :V), (:lvsrc, :LVV, :V), (:lvtgt, :LVV, :V), (:lpvp, :LPV, :P), (:lpvv, :LPV, :V)}, Tuple{:Name, :Op, :Position}, Tuple{(:sname, :S, :Name), (:svname, :SV, :Name), (:fname, :F, :Name), (:vname, :V, :Name), (:pname, :P, :Name), (:vop, :V, :Op), (:lvsposition, :LV, :Position), (:lsvsvposition, :LSV, :Position), (:lvsrcposition, :LVV, :Position), (:lpvpposition, :LPV, :Position)}, Tuple{}}, @NamedTuple{S::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, SV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LS::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, F::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, I::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, O::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, V::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LSV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, P::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LVV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, LPV::Catlab.CategoricalAlgebra.FinSets.FinDomFunctionVector{Int64, Vector{Int64}, Catlab.CategoricalAlgebra.FinSets.FinSetInt}, Name::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Op::Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}, Position::Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}}, StockAndFlowF, StockAndFlowF}[ACSetTransformation((S = FinFunction([1], 1, 13), SV = FinFunction([1], 1, 3), LS = FinFunction([1], 1, 24), F = FinFunction(Int64[], 0, 21), I = FinFunction(Int64[], 0, 21), O = FinFunction(Int64[], 0, 21), V = FinFunction(Int64[], 0, 25), LV = FinFunction(Int64[], 0, 21), LSV = FinFunction(Int64[], 0, 2), P = FinFunction(Int64[], 0, 20), LVV = FinFunction(Int64[], 0, 4), LPV = FinFunction(Int64[], 0, 23), Name = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Op = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Position = Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Int8}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Int8})), FinSet(0))), StockAndFlowF {S:1, SV:1, LS:1, F:0, I:0, O:0, V:0, LV:0, LSV:0, P:0, LVV:0, LPV:0, Name:0, Op:0, Position:0}, StockAndFlowF {S:13, SV:3, LS:24, F:21, I:21, O:21, V:25, LV:21, LSV:2, P:20, LVV:4, LPV:23, Name:0, Op:0, Position:0}), ACSetTransformation((S = FinFunction([2], 1, 13), SV = FinFunction([1], 1, 3), LS = FinFunction([2], 1, 24), F = FinFunction(Int64[], 0, 21), I = FinFunction(Int64[], 0, 21), O = FinFunction(Int64[], 0, 21), V = FinFunction(Int64[], 0, 25), LV = FinFunction(Int64[], 0, 21), LSV = FinFunction(Int64[], 0, 2), P = FinFunction(Int64[], 0, 20), LVV = FinFunction(Int64[], 0, 4), LPV = FinFunction(Int64[], 0, 23), Name = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Op = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Position = Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Int8}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Int8})), FinSet(0))), StockAndFlowF {S:1, SV:1, LS:1, F:0, I:0, O:0, V:0, LV:0, LSV:0, P:0, LVV:0, LPV:0, Name:0, Op:0, Position:0}, StockAndFlowF {S:13, SV:3, LS:24, F:21, I:21, O:21, V:25, LV:21, LSV:2, P:20, LVV:4, LPV:23, Name:0, Op:0, Position:0}), ACSetTransformation((S = FinFunction([3], 1, 13), SV = FinFunction([3, 2, 1], 3, 3), LS = FinFunction([5, 4, 3], 3, 24), F = FinFunction(Int64[], 0, 21), I = FinFunction(Int64[], 0, 21), O = FinFunction(Int64[], 0, 21), V = FinFunction(Int64[], 0, 25), LV = FinFunction(Int64[], 0, 21), LSV = FinFunction(Int64[], 0, 2), P = FinFunction(Int64[], 0, 20), LVV = FinFunction(Int64[], 0, 4), LPV = FinFunction(Int64[], 0, 23), Name = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Op = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Position = Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Int8}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Int8})), FinSet(0))), StockAndFlowF {S:1, SV:3, LS:3, F:0, I:0, O:0, V:0, LV:0, LSV:0, P:0, LVV:0, LPV:0, Name:0, Op:0, Position:0}, StockAndFlowF {S:13, SV:3, LS:24, F:21, I:21, O:21, V:25, LV:21, LSV:2, P:20, LVV:4, LPV:23, Name:0, Op:0, Position:0}), ACSetTransformation((S = FinFunction([4], 1, 13), SV = FinFunction([3, 2, 1], 3, 3), LS = FinFunction([8, 7, 6], 3, 24), F = FinFunction(Int64[], 0, 21), I = FinFunction(Int64[], 0, 21), O = FinFunction(Int64[], 0, 21), V = FinFunction(Int64[], 0, 25), LV = FinFunction(Int64[], 0, 21), LSV = FinFunction(Int64[], 0, 2), P = FinFunction(Int64[], 0, 20), LVV = FinFunction(Int64[], 0, 4), LPV = FinFunction(Int64[], 0, 23), Name = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Op = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Position = Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Int8}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Int8})), FinSet(0))), StockAndFlowF {S:1, SV:3, LS:3, F:0, I:0, O:0, V:0, LV:0, LSV:0, P:0, LVV:0, LPV:0, Name:0, Op:0, Position:0}, StockAndFlowF {S:13, SV:3, LS:24, F:21, I:21, O:21, V:25, LV:21, LSV:2, P:20, LVV:4, LPV:23, Name:0, Op:0, Position:0}), ACSetTransformation((S = FinFunction([6], 1, 13), SV = FinFunction([1], 1, 3), LS = FinFunction([12], 1, 24), F = FinFunction(Int64[], 0, 21), I = FinFunction(Int64[], 0, 21), O = FinFunction(Int64[], 0, 21), V = FinFunction(Int64[], 0, 25), LV = FinFunction(Int64[], 0, 21), LSV = FinFunction(Int64[], 0, 2), P = FinFunction(Int64[], 0, 20), LVV = FinFunction(Int64[], 0, 4), LPV = FinFunction(Int64[], 0, 23), Name = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Op = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Position = Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Int8}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Int8})), FinSet(0))), StockAndFlowF {S:1, SV:1, LS:1, F:0, I:0, O:0, V:0, LV:0, LSV:0, P:0, LVV:0, LPV:0, Name:0, Op:0, Position:0}, StockAndFlowF {S:13, SV:3, LS:24, F:21, I:21, O:21, V:25, LV:21, LSV:2, P:20, LVV:4, LPV:23, Name:0, Op:0, Position:0}), ACSetTransformation((S = FinFunction(Int64[], 0, 13), SV = FinFunction([2], 1, 3), LS = FinFunction(Int64[], 0, 24), F = FinFunction(Int64[], 0, 21), I = FinFunction(Int64[], 0, 21), O = FinFunction(Int64[], 0, 21), V = FinFunction(Int64[], 0, 25), LV = FinFunction(Int64[], 0, 21), LSV = FinFunction(Int64[], 0, 2), P = FinFunction(Int64[], 0, 20), LVV = FinFunction(Int64[], 0, 4), LPV = FinFunction(Int64[], 0, 23), Name = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Op = Catlab.CategoricalAlgebra.FinSets.VarFunction{Symbol}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Symbol}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Symbol})), FinSet(0)), Position = Catlab.CategoricalAlgebra.FinSets.VarFunction{Int8}(FinDomFunction(Union{ACSets.ColumnImplementations.AttrVar, Int8}[], FinSet(0), TypeSet(Union{ACSets.ColumnImplementations.AttrVar, Int8})), FinSet(0))), StockAndFlowF {S:0, SV:1, LS:0, F:0, I:0, O:0, V:0, LV:0, LSV:0, P:0, LVV:0, LPV:0, Name:0, Op:0, Position:0}, StockAndFlowF {S:13, SV:3, LS:24, F:21, I:21, O:21, V:25, LV:21, LSV:2, P:20, LVV:4, LPV:23, Name:0, Op:0, Position:0})]), Union{Nothing, StockAndFlow0}[StockAndFlow0:
  S = 1:1
  SV = 1:1
  LS = 1:1
  Name = 1:0
  lss : LS → S = [1]
  lssv : LS → SV = [1]
  sname : S → Name = [:S]
  svname : SV → Name = [:N], StockAndFlow0:
  S = 1:1
  SV = 1:1
  LS = 1:1
  Name = 1:0
  lss : LS → S = [1]
  lssv : LS → SV = [1]
  sname : S → Name = [:E]
  svname : SV → Name = [:N], StockAndFlow0:
  S = 1:1
  SV = 1:3
  LS = 1:3
  Name = 1:0
  lss : LS → S = [1, 1, 1]
  lssv : LS → SV = [1, 2, 3]
  sname : S → Name = [:IA]
  svname : SV → Name = [:NI, :NIC, :N], StockAndFlow0:
  S = 1:1
  SV = 1:3
  LS = 1:3
  Name = 1:0
  lss : LS → S = [1, 1, 1]
  lssv : LS → SV = [1, 2, 3]
  sname : S → Name = [:IYU]
  svname : SV → Name = [:NI, :NIC, :N], StockAndFlow0:
  S = 1:1
  SV = 1:1
  LS = 1:1
  Name = 1:0
  lss : LS → S = [1]
  lssv : LS → SV = [1]
  sname : S → Name = [:R]
  svname : SV → Name = [:N], StockAndFlow0:
  S = 1:0
  SV = 1:1
  LS = 1:0
  Name = 1:0
  lss : LS → S = Int64[]
  lssv : LS → SV = Int64[]
  sname : S → Name = Symbol[]
  svname : SV → Name = [:NIC]])

composed model

COVID19=apex(openCOVID19)

GraphF(COVID19)

L = @stock_and_flow begin
    :stocks
    VP
    VF
    E

    :parameters
    eP_complement
    eF_complement
    λ
    β


    :flows
    VP => fNewIncidenceVP(v_infVP) => E
    VF => fNewIncidenceVF(v_infVF) => E

    :dynamic_variables
    v_NewIncidence₁ = β * NIC
    v_NewIncidence₂ = v_NewIncidence₁ / N # λ

    v_NewIncidenceVP = VP * eP_complement
    v_NewIncidenceVF = VF * eF_complement

    v_infVP = v_NewIncidenceVP * λ
    v_infVF = v_NewIncidenceVF * λ


    :sums
    N = [VP, VF, E]
    NIC = []
end;

GraphF(L)

I = @stock_and_flow begin
    :stocks
    VP
    VF
    E

    :parameters
    eP_complement
    eF_complement
    β

    :flows
    VP => fNewIncidenceVP(v_infVP) => E
    VF => fNewIncidenceVF(v_infVF) => E

    :dynamic_variables
    v_NewIncidence₁ = β * NIC
    v_NewIncidence₂ = v_NewIncidence₁ / N # λ
    v_NewIncidenceVP = VP * eP_complement
    v_NewIncidenceVF = VF * eF_complement


    v_infVP = *(v_NewIncidenceVP)
    v_infVF = *(v_NewIncidenceVF)

    :sums
    N = [VP, VF, E]
    NIC = []
end;

GraphF(I)

R = @stock_and_flow begin
    :stocks
    VP
    VF
    E

    :parameters
    eP_complement
    eF_complement
    β

    :flows
    VP => fNewIncidenceVP(v_infVP) => E
    VF => fNewIncidenceVF(v_infVF) => E

    :dynamic_variables
    v_NewIncidence₁ = β * NIC
    v_NewIncidence₂ = v_NewIncidence₁ / N # λ

    v_NewIncidenceVP = VP * eP_complement
    v_NewIncidenceVF = VF * eF_complement


    v_infVP = v_NewIncidenceVP * v_NewIncidence₂
    v_infVF = v_NewIncidenceVF * v_NewIncidence₂


    :sums
    N = [VP, VF, E]
    NIC = []
end;

GraphF(R)

using AlgebraicRewriting
using AlgebraicRewriting: rewrite
const hom = Catlab.CategoricalAlgebra.homomorphism

rule = Rule(hom(I,L), hom(I,R))

Covid19_rewritten = rewrite(rule, COVID19)
GraphF(Covid19_rewritten)

Covid19_rewritten

GraphF(Covid19_rewritten; type="SF", rd="TB")
Example block output

define constant parameters

p_COVID19_raw = LVector(
    β=0.8, tLatent=2.9, tIncubation=2.72, tDevelop=6.0, tRecovery=3.5,tw=2*365.0,
    fH=0.002, fICU=0.23, tICU=6.0, tH = 12.0, tOutICU=6.0, fractionIA=0.4
)


p_COVID19 = LVector(
    β=p_COVID19_raw.β, rLatent=1.0/p_COVID19_raw.tLatent, rIncubation=(1.0-p_COVID19_raw.fractionIA)/p_COVID19_raw.tIncubation,
    rDevelop=(1.0-p_COVID19_raw.fH)/p_COVID19_raw.tDevelop, rRecovery=1.0/p_COVID19_raw.tRecovery, rw=1.0/p_COVID19_raw.tw,
    rv=0.01, eP=0.6, eF=0.85, rIncubationIA=p_COVID19_raw.fractionIA/p_COVID19_raw.tIncubation,
    rDevelopIA2=1.0/p_COVID19_raw.tDevelop, rRecoveryIA3=1.0/p_COVID19_raw.tRecovery,
    rAdmICU=p_COVID19_raw.fH*p_COVID19_raw.fICU/p_COVID19_raw.tDevelop,
    rAdmNICU=p_COVID19_raw.fH*(1.0-p_COVID19_raw.fICU)/p_COVID19_raw.tDevelop,
    rrH=1.0/p_COVID19_raw.tH, rOutICU=1.0/p_COVID19_raw.tOutICU,rDeathICU=0.085, rDeathNICU=0.018,
    eP_complement = 0.4, eF_complement = 0.15
)
20-element LabelledArrays.LArray{Float64, 1, Vector{Float64}, (:β, :rLatent, :rIncubation, :rDevelop, :rRecovery, :rw, :rv, :eP, :eF, :rIncubationIA, :rDevelopIA2, :rRecoveryIA3, :rAdmICU, :rAdmNICU, :rrH, :rOutICU, :rDeathICU, :rDeathNICU, :eP_complement, :eF_complement)}:
             :β => 0.8
       :rLatent => 0.3448275862068966
   :rIncubation => 0.2205882352941176
      :rDevelop => 0.16633333333333333
     :rRecovery => 0.2857142857142857
            :rw => 0.0013698630136986301
                ⋮
       :rOutICU => 0.16666666666666666
     :rDeathICU => 0.085
    :rDeathNICU => 0.018
 :eP_complement => 0.4
 :eF_complement => 0.15

define initial values for stocks

u0_COVID19 = LVector(
    S=38010000.0, E=0.0, IYU=10.0, IA=0.0, R=0.0, HICU=0.0, HNICU=0.0, VP=0.0, VF=0.0,
    D=0.0, IA2=0.0, IA3=0.0, IYN=0.0
)
13-element LabelledArrays.LArray{Float64, 1, Vector{Float64}, (:S, :E, :IYU, :IA, :R, :HICU, :HNICU, :VP, :VF, :D, :IA2, :IA3, :IYN)}:
    :S => 3.801e7
    :E => 0.0
  :IYU => 10.0
   :IA => 0.0
    :R => 0.0
 :HICU => 0.0
       ⋮
   :VF => 0.0
    :D => 0.0
  :IA2 => 0.0
  :IA3 => 0.0
  :IYN => 0.0

results are tested the same as the Anylogic model

prob_COVID19 = ODEProblem(vectorfield(Covid19_rewritten),u0_COVID19,(0.0,100.0),p_COVID19);
sol_COVID19 = solve(prob_COVID19,Tsit5(),abstol=1e-8);
plot(sol_COVID19)
Example block output

to have the figures plotted fix to the wider of the cells

HTML("""
<style>
.output_svg div{
  width: 100% !important;
  height: 100% !important;
}
</style>
""")