-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Schemas for Stock and Flow #35
base: main
Are you sure you want to change the base?
Changes from 9 commits
feb59e3
d00aae6
ac88447
6cc5dd5
8c8ca7a
3e3fcff
0470438
e124b1f
b2ea336
a14bb9c
cad1534
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ where = src | |
tests = | ||
pytest | ||
coverage | ||
jsonschema | ||
docs = | ||
sphinx | ||
sphinx-rtd-theme | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"""Schemas and examples.""" | ||
|
||
from pathlib import Path | ||
|
||
HERE = Path(__file__).parent.resolve() | ||
CATLAB = HERE.joinpath("catlab") | ||
JSONSCHEMA = HERE.joinpath("jsonschema") | ||
EXAMPLES = HERE.joinpath("examples") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
{ | ||
"version": { | ||
"ACSets": "0.0.0", | ||
"ACSetSchema": "0.0.1", | ||
"Catlab": "0.0.0" | ||
}, | ||
"Ob": [ | ||
{ | ||
"title": "Stocks", | ||
"description": "A variable in the model", | ||
"name": "S" | ||
}, | ||
{ | ||
"title": "Sum Aux", | ||
"description": "Sum Auxiliary Variable", | ||
"name": "SV" | ||
}, | ||
{ | ||
"title": "Linkage", | ||
"description": null, | ||
"name": "LS" | ||
}, | ||
{ | ||
"title": "Flow", | ||
"description": "A flow between stocks", | ||
"name": "F" | ||
}, | ||
{ | ||
"title": "Input", | ||
"description": "The input arcs", | ||
"name": "I" | ||
}, | ||
{ | ||
"title": "Output", | ||
"description": "The output arcs", | ||
"name": "O" | ||
}, | ||
{ | ||
"title": "Variable?", | ||
"description": null, | ||
"name": "V" | ||
}, | ||
{ | ||
"title": "Linkage Variable?", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are some question marks here we probably want to address |
||
"description": null, | ||
"name": "LV" | ||
}, | ||
{ | ||
"title": "Linkage Sum Variables?", | ||
"description": null, | ||
"name": "LSV" | ||
} | ||
], | ||
"Hom": [ | ||
{ | ||
"title": "LS to stock", | ||
"description": null, | ||
"name": "lss", | ||
"codom": "S", | ||
"dom": "LS" | ||
}, | ||
{ | ||
"title": "LS to SV", | ||
"description": null, | ||
"name": "lssv", | ||
"codom": "SV", | ||
"dom": "LS" | ||
}, | ||
{ | ||
"title": "Input to Function", | ||
"description": null, | ||
"name": "ifn", | ||
"codom": "F", | ||
"dom": "I" | ||
}, | ||
{ | ||
"title": "Input variable", | ||
"description": null, | ||
"name": "is", | ||
"codom": "S", | ||
"dom": "I" | ||
}, | ||
{ | ||
"title": "Output of Function", | ||
"description": null, | ||
"name": "ofn", | ||
"codom": "F", | ||
"dom": "O" | ||
}, | ||
{ | ||
"title": "Output Variable", | ||
"description": null, | ||
"name": "os", | ||
"codom": "S", | ||
"dom": "O" | ||
}, | ||
{ | ||
"title": "Variable Result of Function", | ||
"description": null, | ||
"name": "fv", | ||
"codom": "V", | ||
"dom": "F" | ||
}, | ||
{ | ||
"title": "S of V", | ||
"description": null, | ||
"name": "lvs", | ||
"codom": "S", | ||
"dom": "LV" | ||
}, | ||
{ | ||
"title": "V of LV", | ||
"description": null, | ||
"name": "lvv", | ||
"codom": "V", | ||
"dom": "LV" | ||
}, | ||
{ | ||
"title": "SV of LSV", | ||
"description": null, | ||
"name": "lsvsv", | ||
"codom": "SV", | ||
"dom": "LSV" | ||
}, | ||
{ | ||
"title": "V of LSV", | ||
"description": null, | ||
"name": "lsvv", | ||
"codom": "V", | ||
"dom": "LSV" | ||
} | ||
], | ||
"AttrType": [ | ||
{ | ||
"name": "Name", | ||
"title": "Name of Entity", | ||
"description": null, | ||
"ty": "str" | ||
}, | ||
{ | ||
"name": "FuncDynam", | ||
"title": "Dynamics Function", | ||
"description": null, | ||
"ty": "str" | ||
} | ||
], | ||
"Attr": [ | ||
{ | ||
"title": "Stock Name", | ||
"description": null, | ||
"name": "sname", | ||
"codom": "Name", | ||
"dom": "S" | ||
}, | ||
{ | ||
"title": "SV Name", | ||
"description": null, | ||
"name": "svname", | ||
"codom": "Name", | ||
"dom": "SV" | ||
}, | ||
{ | ||
"title": "Function Name", | ||
"description": null, | ||
"name": "fname", | ||
"codom": "Name", | ||
"dom": "F" | ||
}, | ||
{ | ||
"title": "Variable Name", | ||
"description": null, | ||
"name": "vname", | ||
"codom": "Name", | ||
"dom": "V" | ||
}, | ||
{ | ||
"title": "Dynamics Function of Variable", | ||
"description": null, | ||
"name": "funcDynam", | ||
"codom": "FuncDynam", | ||
"dom": "V" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{ | ||
"version": { | ||
"ACSets": "0.0.0", | ||
"ACSetSchema": "0.0.1", | ||
"Catlab": "0.0.0" | ||
}, | ||
"Ob": [ | ||
{ | ||
"name": "Flow", | ||
"title": "Flow", | ||
"description": null | ||
}, | ||
{ | ||
"name": "Stock", | ||
"title": "Stock", | ||
"description": null | ||
}, | ||
{ | ||
"name": "Link", | ||
"title": "Link", | ||
"description": null | ||
} | ||
], | ||
"Hom": [ | ||
{ | ||
"name": "u", | ||
"codom": "Stock", | ||
"dom": "Flow", | ||
"title": "upstream", | ||
"description": null | ||
}, | ||
{ | ||
"name": "d", | ||
"codom": "Stock", | ||
"dom": "Flow", | ||
"title": "downstream", | ||
"description": null | ||
}, | ||
{ | ||
"name": "s", | ||
"codom": "Stock", | ||
"dom": "Link", | ||
"title": "source", | ||
"description": null | ||
}, | ||
{ | ||
"name": "t", | ||
"codom": "Flow", | ||
"dom": "Link", | ||
"title": "target", | ||
"description": null | ||
} | ||
], | ||
"AttrType": [ | ||
{ | ||
"name": "Name", | ||
"title": "Names", | ||
"description": "Name of an entity in the model.", | ||
"ty": "str" | ||
}, | ||
{ | ||
"name": "FuncFlow", | ||
"title": "Flow Functions", | ||
"description": "A representation of the flow function. Currently a math expression in string form.", | ||
"ty": "str" | ||
} | ||
], | ||
"Attr": [ | ||
{ | ||
"title": "Stock Name", | ||
"description": null, | ||
"name": "sname", | ||
"codom": "Name", | ||
"dom": "Stock" | ||
}, | ||
{ | ||
"title": "Flow Name", | ||
"description": null, | ||
"name": "fname", | ||
"codom": "Name", | ||
"dom": "Flow" | ||
}, | ||
{ | ||
"title": "Flow Function", | ||
"description": null, | ||
"name": "ϕf", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there any potential integration issues with using a less-common unicode character as a JSON key? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should test the JSON libraries. This would be a breaking change to StockFlow.jl so let's find an upstream bug before we patch it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah. I didn't realize that this would be a breaking change in the other library. According to the JSON spec, it should be fine, and it obviously works in Python and JS, so I'm happy to assume that everything conforms to the spec until proven otherwise. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah the SF.jl library already exists and I was trying to get this in to py-acsets with the minimal code change possible. So far we haven't made any other changes to SF.jl. |
||
"codom": "FuncFlow", | ||
"dom": "Flow" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"Flow": [ | ||
{ | ||
"_id": 1, | ||
"u": 1, | ||
"d": 2, | ||
"fname": "NewIncidence", | ||
"ϕf": "p.cβ*u.S*u.I/p.N" | ||
}, | ||
{ | ||
"_id": 2, | ||
"u": 2, | ||
"d": 3, | ||
"fname": "NewRecovery", | ||
"ϕf": "(u.I/p.tr)" | ||
} | ||
], | ||
"Stock": [ | ||
{ | ||
"_id": 1, | ||
"sname": "S" | ||
}, | ||
{ | ||
"_id": 2, | ||
"sname": "I" | ||
}, | ||
{ | ||
"_id": 3, | ||
"sname": "R" | ||
} | ||
], | ||
"Link": [ | ||
{ | ||
"_id": 1, | ||
"s": 1, | ||
"t": 1 | ||
}, | ||
{ | ||
"_id": 2, | ||
"s": 2, | ||
"t": 1 | ||
}, | ||
{ | ||
"_id": 3, | ||
"s": 2, | ||
"t": 2 | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it the case that all elements will always be lists? If that's the case, we can use this line to introduce default empty lists.