Skip to content
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

Schematic release v24.1.1 #1354

Merged
merged 277 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
277 commits
Select commit Hold shift + click to select a range
600fdd6
fix convert_bool function processing
mialy-defelice Jun 28, 2023
04904be
add TODO
mialy-defelice Jun 28, 2023
292522e
fix jsonld processsing, optimize, reorder entries
mialy-defelice Jun 28, 2023
c557c91
Fix error with getting property and class labels from display names
mialy-defelice Jun 28, 2023
44db57a
Merge branch 'develop' of https://github.com/Sage-Bionetworks/schemat…
mialy-defelice Jul 27, 2023
e4c9811
merge and add relationships class
mialy-defelice Jul 27, 2023
6a9590f
update schemas to change node order to match develop, add edge_key
mialy-defelice Jul 29, 2023
d1fbeb0
finish fixing jsonld to work with flipped edges that match dev
mialy-defelice Aug 1, 2023
ab7cab1
add json validation code
mialy-defelice Aug 1, 2023
c8da352
changes to allow json schema validation and manifest generation
mialy-defelice Aug 2, 2023
d5a95c1
remove breakpoint
mialy-defelice Aug 3, 2023
0b2f052
remove unused functions
mialy-defelice Aug 3, 2023
c33020c
add inline comment
mialy-defelice Aug 3, 2023
397e326
update data model validator, add unit tests and test models
mialy-defelice Aug 16, 2023
1ba8049
add additional docstrings to JSONLD parser
mialy-defelice Aug 16, 2023
3daac3a
add additional docstrings to data_model_relationships
mialy-defelice Aug 16, 2023
c15dda4
add get_subgraph_by_edge_type
mialy-defelice Aug 16, 2023
b8e4da9
update all tests to work with new schemas
mialy-defelice Aug 25, 2023
e51e7f1
update all referencing so all tests CLI calls and APIs work
mialy-defelice Aug 25, 2023
81fc11e
handle merge conflicts
mialy-defelice Aug 27, 2023
89764d4
remove old schemas files that are no longer used
mialy-defelice Aug 27, 2023
7fd5dfc
change the name of the old validator.py to json_schema_validator.py t…
mialy-defelice Aug 27, 2023
3161710
updatate inline docstrings in manifest/generator.py
mialy-defelice Aug 28, 2023
c60b0f0
clean/document data_model_relationships
mialy-defelice Sep 6, 2023
95249e8
clean/document schemas/commands.py
mialy-defelice Sep 8, 2023
86b5d8a
clean document schemas/data_model_edges
mialy-defelice Sep 8, 2023
4a1c519
clean/document data_model_graph.py
mialy-defelice Sep 11, 2023
e8b4b9f
clean document schematic/schemas/data_model_json_schema.py
mialy-defelice Sep 11, 2023
153fac0
clean/document schematic/schemas/data_model_jsonld.py
mialy-defelice Sep 11, 2023
4358abe
clean/document schematic/schemas/data_model_nodes.py
mialy-defelice Sep 11, 2023
965b0b3
clean/document schematic/schemas/data_model_parser.py
mialy-defelice Sep 11, 2023
a169068
update function names
mialy-defelice Sep 11, 2023
45eff99
clean/document schematic/schemas/data_model_validator.py
mialy-defelice Sep 11, 2023
c2f6d51
remove unused import convert_size
mialy-defelice Sep 11, 2023
5eceedf
clean/document rename functions in schematic/utils/schema_utils.py
mialy-defelice Sep 11, 2023
95c0b32
import typing to schema_utils
mialy-defelice Sep 12, 2023
b56b05f
add to docstring
mialy-defelice Sep 12, 2023
87e3cdc
pull label for entry if display name not recorded when parsing JSONLD
mialy-defelice Sep 12, 2023
15c06e5
update find_class_specific_properties to work from graph
mialy-defelice Sep 12, 2023
37fd108
resolve merge conflicts
mialy-defelice Sep 15, 2023
7692253
add new line
mialy-defelice Sep 15, 2023
6b24f66
remove unused code and explicitly call parameter when getting validat…
mialy-defelice Sep 15, 2023
c4e9c59
update data model handling in MetadataModel so can take in JSONLD or …
mialy-defelice Sep 15, 2023
f1da61b
remove spaces
mialy-defelice Sep 15, 2023
bdb6469
explicitly call node_display_name paramter rather than rely on positi…
mialy-defelice Sep 15, 2023
da0c28d
explicitly call node_display_name paramter rather than rely on positi…
mialy-defelice Sep 15, 2023
2b301ac
clean/document data_model_graph
mialy-defelice Sep 15, 2023
7bf1733
fix data model handling
mialy-defelice Sep 15, 2023
bf90b8b
clean/document schematic/schemas/data_model_json_schema.py
mialy-defelice Sep 15, 2023
120bf1b
update function names
mialy-defelice Sep 15, 2023
7040714
add logger warning about JSONLD and a docstring
mialy-defelice Sep 15, 2023
ba20d4c
explicitly call variables
mialy-defelice Sep 15, 2023
eaa768a
update routes to take CSV
mialy-defelice Sep 15, 2023
89e83ce
added TODO
mialy-defelice Sep 15, 2023
4716e4e
Add stubs for tests/test_schemas.py
mialy-defelice Sep 17, 2023
f7fb1aa
added first set of tests for DataModelRelationships class
andrewelamb Sep 20, 2023
9e7298b
add test_get_base_schema_path test, update DME that is yielded to tak…
mialy-defelice Sep 20, 2023
1e6a984
improved tests
andrewelamb Sep 21, 2023
5d7864d
add test_get_model_type
mialy-defelice Sep 22, 2023
17a54bf
dont take path to data model for get_model_type
mialy-defelice Sep 22, 2023
2cb11e2
add test_parse_model and use helpers to get data_model_parser
mialy-defelice Sep 22, 2023
b8a509d
add helper to get_data_model_parser
mialy-defelice Sep 22, 2023
8152ddc
fix issues with changing how data_model_parser instantiated
mialy-defelice Sep 22, 2023
6071920
add data_model_parser helpers function, and update relevant parts of …
mialy-defelice Sep 22, 2023
be5181d
add TestDataModelCsvParser tests
mialy-defelice Sep 25, 2023
695ce49
add helper to get_data_model_json_schema
mialy-defelice Sep 25, 2023
47efa56
add test TestDataModelJsonSchema::test_get_array_schema
mialy-defelice Sep 25, 2023
1fc6fbc
add test TestDataModelJsonSchema::test_get_non_blank_schema
mialy-defelice Sep 25, 2023
2702838
remove true statements in test_get_array_schema
mialy-defelice Sep 25, 2023
b3188ec
add todo
mialy-defelice Sep 25, 2023
1150487
add tests TestDataModelJsonSchema::test_get_range_schema
mialy-defelice Sep 25, 2023
16d8d15
add tests TestDataModelJsonSchema::test_get_json_validation_schema
mialy-defelice Sep 26, 2023
b273ac4
add test TestDataModelJsonLdParser::test_gather_jsonld_attributes_rel…
mialy-defelice Sep 26, 2023
27b67ef
add test TestDataModelJsonLdParser::test_parse_jsonld_model
mialy-defelice Sep 26, 2023
b4dc47a
add tests TestDataModelGraph::test_generate_data_model_graph
mialy-defelice Sep 26, 2023
d9bd70d
Merge pull request #1309 from Sage-Bionetworks/develop-refactor-schem…
mialy-defelice Sep 27, 2023
d4895da
Merge pull request #1293 from Sage-Bionetworks/feature-fds-1058-tests
andrewelamb Sep 28, 2023
2516d49
move get_data_model_nodes to test_schemas function
mialy-defelice Oct 2, 2023
368dada
add test_gather_all_nodes
mialy-defelice Oct 3, 2023
f0d030b
add tets for test_get_rel_node_dict and test_get_data_model_properties
mialy-defelice Oct 4, 2023
ebe11b2
add test_run_rel_functions
mialy-defelice Oct 9, 2023
aab69f7
add TODO to DataModelNodes
mialy-defelice Oct 9, 2023
0036db0
add docstring for cases to test
GiaJordan Sep 25, 2023
a374f99
add self loop to validation test model
GiaJordan Sep 28, 2023
9c7bd06
add slots for other tests
GiaJordan Sep 28, 2023
247b63a
add test to ensure self loop edges are not added
GiaJordan Sep 28, 2023
269ca0f
change edge checking
GiaJordan Sep 28, 2023
dcf4872
make a deepcopy
GiaJordan Sep 28, 2023
bedda93
add test for adding edges
GiaJordan Sep 29, 2023
1be618d
WIP add test for edge weights
GiaJordan Sep 29, 2023
02b1c61
add comments
GiaJordan Oct 10, 2023
8e21b6c
add weight checks in test
GiaJordan Oct 10, 2023
368834a
change test case
GiaJordan Oct 10, 2023
5cc5a2c
update expected schema validator errors
GiaJordan Oct 10, 2023
3f20706
add tests for generate node dict and test_generate_nod
mialy-defelice Oct 10, 2023
47021c0
Merge pull request #1307 from Sage-Bionetworks/develop-unit-tests-jso…
mialy-defelice Oct 10, 2023
fe16b2b
Merge branch 'develop-refactor-schemas' of https://github.com/Sage-Bi…
mialy-defelice Oct 10, 2023
50344b4
update example and test model with new component
GiaJordan Oct 10, 2023
6af0009
add test for property weights
GiaJordan Oct 10, 2023
fdc5399
resolve merge conflicts
mialy-defelice Oct 10, 2023
eb788e7
fix ref to schema Generator, pulled in with merging dev
mialy-defelice Oct 10, 2023
98e15b6
fix additional merge conflicts
mialy-defelice Oct 11, 2023
1044c39
remove `cohorts` component from test models
GiaJordan Oct 11, 2023
026862e
create new model for component w/ properties
GiaJordan Oct 11, 2023
1c4b880
parametrize data model path
GiaJordan Oct 11, 2023
5c5991c
remove print statement
GiaJordan Oct 11, 2023
dfc5ca3
use DMR fixture, change name cap
GiaJordan Oct 11, 2023
2ab025e
add fixture for DataModelEdges object
GiaJordan Oct 11, 2023
af51f09
use dataModelParser helper fxn
GiaJordan Oct 11, 2023
a7a9e7c
change df column names
GiaJordan Oct 11, 2023
47a49fb
change assertion logic to explicitly check that nodes were added
GiaJordan Oct 11, 2023
f7f7e58
update comments and log message
GiaJordan Oct 11, 2023
641748f
clean spacing / update comments
GiaJordan Oct 11, 2023
ec06372
Revert "update expected schema validator errors"
GiaJordan Oct 11, 2023
19fafd3
fix issue in test_get_json_validation__schema
mialy-defelice Oct 11, 2023
0271f7f
Revert "Revert "update expected schema validator errors""
GiaJordan Oct 11, 2023
0b02a8e
add tests for TestDataModelJsonLd, test_init, and test_base_jsonld_te…
mialy-defelice Oct 11, 2023
b43abdd
add tests for TestDataModelJsonLD, test_init, test_base_jsonld_templa…
mialy-defelice Oct 11, 2023
bd5b450
add test for test_clean_template
mialy-defelice Oct 11, 2023
5158b86
add test for test_strip_context
mialy-defelice Oct 11, 2023
3f66bfc
add test for test_reorder_template_entries
mialy-defelice Oct 11, 2023
77a3837
add test for test_property_template
mialy-defelice Oct 11, 2023
78cf6e7
add tests for test_class_template
mialy-defelice Oct 11, 2023
8cd9c60
add tests for test_generate_jsonld_object
mialy-defelice Oct 11, 2023
bf8b80c
add tests for test_convert_graph_to_jsonld
mialy-defelice Oct 11, 2023
7fd08b4
add nx import
mialy-defelice Oct 11, 2023
3409700
add data model dict and change assert statements
mialy-defelice Oct 11, 2023
99c57dd
add comments about the state of the graph
mialy-defelice Oct 12, 2023
d3d89b5
remove unused imports
mialy-defelice Oct 12, 2023
4ce312b
change key to rel_key to be more descriptive
mialy-defelice Oct 12, 2023
5415497
update typing and comments
mialy-defelice Oct 12, 2023
f16055b
updat function name and reference, also typing in data_model_nodes
mialy-defelice Oct 12, 2023
a8742c3
add comment about graph state
mialy-defelice Oct 12, 2023
9d09d80
to data_model_parse, rewrite try, except, move self ref, and update d…
mialy-defelice Oct 12, 2023
809a817
add additional functions to simplify gather_csv_attributes_relationsh…
mialy-defelice Oct 12, 2023
65979a0
for DataModelJsonldParser, add some functions to simplify parsing com…
mialy-defelice Oct 12, 2023
d4f34d7
fix ref to entry_name, to attr_key
mialy-defelice Oct 12, 2023
f815e05
convert templates to dataclass, dataclass_json, update references, an…
mialy-defelice Oct 13, 2023
c89594b
fix issue with convert jsonstr to dict
mialy-defelice Oct 13, 2023
a7cfa94
add strip_contex to utils
mialy-defelice Oct 13, 2023
0f30c7e
add additional check when adding back contexts
mialy-defelice Oct 13, 2023
d90a7b5
fix typo in api
mialy-defelice Oct 13, 2023
4e99815
WIP: combine functions to look for value and edge rels
mialy-defelice Oct 13, 2023
48b8236
Removed commented relationship functions
mialy-defelice Oct 13, 2023
8d23805
remake poetry.lock file
mialy-defelice Oct 16, 2023
523a1c2
remake poetry.lock file
mialy-defelice Oct 16, 2023
5847762
Merge pull request #1313 from Sage-Bionetworks/develop-refactor-schem…
mialy-defelice Oct 16, 2023
aee8589
change lock-version to 1.1 manually in poetry.lock
mialy-defelice Oct 16, 2023
ad2e8a2
remake the poetry.lock file again
mialy-defelice Oct 16, 2023
7de8a59
update test_utils to properly take in datacalsses
mialy-defelice Oct 16, 2023
6dc7f08
update naming in clean template and add andditional docstrings for cl…
mialy-defelice Oct 16, 2023
2255ab1
update some k v pair naming to be more descriptive
mialy-defelice Oct 17, 2023
446f6d4
Update github actions poetry version
mialy-defelice Oct 17, 2023
a5045cc
update example jsonld
mialy-defelice Oct 17, 2023
ebcf3e2
import logging and remove unused import
mialy-defelice Oct 17, 2023
1b1c9eb
remove ununsed imports from data_model_graph and move to use list ove…
mialy-defelice Oct 17, 2023
49d2817
clean up unused imports and fix all references that were broken, upda…
mialy-defelice Oct 17, 2023
4e16111
fix issue with ref to node
mialy-defelice Oct 18, 2023
1609a04
remove true == assert from test_schemas
mialy-defelice Oct 18, 2023
4942fba
Merge pull request #1315 from Sage-Bionetworks/develop-refactor-schem…
mialy-defelice Oct 18, 2023
6ef90dd
update test_schemas and test_utils for new functions
mialy-defelice Oct 18, 2023
07d5365
add required to class template
mialy-defelice Oct 18, 2023
af36ca6
Merge branch 'develop-refactor-schemas' into develop-refactor-schemas…
mialy-defelice Oct 18, 2023
ca28067
Merge pull request #1304 from Sage-Bionetworks/develop-refactor-schem…
mialy-defelice Oct 18, 2023
3ec40c5
Merge branch 'develop-refactor-schemas' into develop-refactor-schemas…
mialy-defelice Oct 18, 2023
9c65a6c
Merge pull request #1310 from Sage-Bionetworks/develop-refactor-schem…
mialy-defelice Oct 18, 2023
606d9cc
Merge branch 'develop-refactor-schemas' into develop-TestDataModelCsv…
mialy-defelice Oct 18, 2023
283ff95
Merge pull request #1305 from Sage-Bionetworks/develop-TestDataModelC…
mialy-defelice Oct 18, 2023
0562347
remove test_schemas portion
mialy-defelice Oct 18, 2023
27cb86b
change fixture name
GiaJordan Oct 18, 2023
b58a185
remove returns
GiaJordan Oct 18, 2023
5321ff3
add comment on negative weight
GiaJordan Oct 18, 2023
d0287ef
change var cap
GiaJordan Oct 18, 2023
731293b
move functions out of conftest, and clean up conftest functions that …
mialy-defelice Oct 19, 2023
516413c
clean up tests after merging all togther make cohesive, address comments
mialy-defelice Oct 19, 2023
163f096
run black on tests/test_schemas.py
mialy-defelice Oct 19, 2023
278cf31
remove base_schema from help
mialy-defelice Oct 19, 2023
63a887c
run black on schematic/schemas/commands.py
mialy-defelice Oct 19, 2023
6819c2f
run black on schematic/schemas/data_model_edges.py
mialy-defelice Oct 19, 2023
480f4bf
run black on schematic/schemas/data_model_graph.py
mialy-defelice Oct 19, 2023
4a44c16
run black on schematic/schemas/data_model_json_schema.py
mialy-defelice Oct 19, 2023
e64e03a
run black on schematic/schemas/data_model_jsonld.py
mialy-defelice Oct 19, 2023
8f35606
run black on schematic/schemas/data_model_nodes.py
mialy-defelice Oct 19, 2023
ef6252a
run black on schematic/schemas/data_model_parser.py
mialy-defelice Oct 19, 2023
16a2b31
run black on schematic/schemas/data_model_validator.py
mialy-defelice Oct 19, 2023
c43d13a
run black on schematic/schemas/data_model_relationships.py
mialy-defelice Oct 19, 2023
8b843ee
add note on self loop error
GiaJordan Oct 19, 2023
531d476
Merge branch 'develop-refactor-schemas' into develop-generate-edge-te…
mialy-defelice Oct 19, 2023
e52b967
Merge pull request #1306 from Sage-Bionetworks/develop-generate-edge-…
mialy-defelice Oct 19, 2023
3088ac5
merge in data_model_edges tests
mialy-defelice Oct 19, 2023
caba6bd
update all references to DME to DMGE
mialy-defelice Oct 19, 2023
617c4c1
fix issue where .jsonld was doubled when converting jsonld to jsonld
mialy-defelice Oct 19, 2023
d985fb4
fix construction of attr:rel dict when parsing JSONLD so that ispart…
mialy-defelice Oct 19, 2023
2d6ae20
update data model edges to update a list instead of the graph directly
mialy-defelice Oct 24, 2023
85ae4fa
add timing to cycle finding so that it will move on if too many cycle…
mialy-defelice Oct 24, 2023
f57b31a
fix typing error in data_model_edges
mialy-defelice Oct 24, 2023
9b77be9
fix issue with get_ordered_entry
mialy-defelice Oct 24, 2023
459120a
WIP: fix domain includes handling, contains subclass off issue
mialy-defelice Oct 24, 2023
44cc0e8
change jsonld direction for domainIncludes and update jsonld to remov…
mialy-defelice Oct 24, 2023
a7def06
handle subclassOf and domainIncludes separately when handling edge re…
mialy-defelice Oct 24, 2023
e2f540e
update JSONLD parsing to better handle properties
mialy-defelice Oct 24, 2023
7181728
update test_skip_edge to work with new edge_list handling
mialy-defelice Oct 24, 2023
c9737b3
add parentOf in the JSONLD parsing update, also change some naming to…
mialy-defelice Oct 25, 2023
2cd4f85
update graph tests to conform to new list expectations
mialy-defelice Oct 25, 2023
a62530e
update validation tests to use dmge vs DME
mialy-defelice Oct 25, 2023
1511eb3
update the expected errors since the old errors are just printed as w…
mialy-defelice Oct 25, 2023
40a3025
Merge pull request #1321 from Sage-Bionetworks/develop-refactor-schem…
mialy-defelice Oct 25, 2023
74d3b98
convert breakpoint to logger error
mialy-defelice Oct 25, 2023
c4ccd01
resolve merge conflicts
mialy-defelice Nov 7, 2023
8b25ce7
update poetry.lock file
mialy-defelice Nov 7, 2023
bce17f5
regenerate poetry.lock file
mialy-defelice Nov 7, 2023
437c153
Merge branch 'develop' into develop-refactor-schemas
linglp Nov 15, 2023
7e1c168
modify workflow to trigger a release to pypi
linglp Nov 15, 2023
93a1121
test changing the requirements when publishing to pypi
linglp Nov 15, 2023
b6f6ccc
commented out the if statement
linglp Nov 15, 2023
eed68b1
comment out another if in workflow
linglp Nov 15, 2023
d19bf03
release version
linglp Nov 15, 2023
6f55626
add import
linglp Nov 16, 2023
58fdc88
Merge pull request #1327 from Sage-Bionetworks/develop-refactor-schem…
linglp Nov 16, 2023
b1fb47d
add comments
linglp Nov 16, 2023
b0788c7
revert changes related to workflow
linglp Nov 16, 2023
0c00e58
only add values to parsed entry list, if it has a value
mialy-defelice Nov 17, 2023
bf4e10d
Merge pull request #1329 from Sage-Bionetworks/develop-refactor-schem…
mialy-defelice Dec 11, 2023
78ba12c
change parentOf to subclassOf to reference relationship properly and …
mialy-defelice Dec 11, 2023
93274fa
Revert "change parentOf to subclassOf to reference relationship prope…
mialy-defelice Dec 11, 2023
c66d799
Merge pull request #1328 from Sage-Bionetworks/develop-revert-workflo…
linglp Dec 12, 2023
ce8f2f0
Merge pull request #1338 from Sage-Bionetworks/develop-rs-bug-FDS-1442
mialy-defelice Dec 12, 2023
3944133
Revert "Refactor Schemas: Initial Release BugFix, incorrect name caus…
mialy-defelice Dec 14, 2023
0ecda5a
re-add change to change parentOf to subClassOf
mialy-defelice Dec 14, 2023
3367b04
Merge pull request #1343 from Sage-Bionetworks/revert-1338-develop-rs…
mialy-defelice Dec 14, 2023
3a15e02
Merge pull request #1344 from Sage-Bionetworks/develop-rs-bug-FDS-1442
mialy-defelice Dec 14, 2023
aa19fd3
resolve merge conflicts
mialy-defelice Jan 8, 2024
0784d43
add new data model dictionary to map between label and display name
mialy-defelice Jan 9, 2024
81ffeb9
Merge branch 'develop-refactor-schemas' into develop-rs-final-dev-merge
mialy-defelice Jan 9, 2024
052d172
remove breaks
mialy-defelice Jan 9, 2024
722e4ca
update data model jsonld
mialy-defelice Jan 9, 2024
4918ef7
WIP: fix JSONLD parsing so display names are used instead of labels
mialy-defelice Jan 16, 2024
0f99f51
update tests/test_schemas.py to conform to JSONLD parsing using displ…
mialy-defelice Jan 16, 2024
3d662fa
update CLI tests for new path_to_data_model argument name
mialy-defelice Jan 16, 2024
dd5e535
clean up earlier WIP commit
mialy-defelice Jan 16, 2024
64b16e0
fix issue with poetry.lock merge
mialy-defelice Jan 16, 2024
c4cb399
fix issue with poetry.lock merge
mialy-defelice Jan 16, 2024
c61c182
change from app.logger to logger
mialy-defelice Jan 17, 2024
6563f63
WIP: add temp models
mialy-defelice Jan 17, 2024
97ecc15
fix dev merge issue, use_annotations added to create_single manifest
mialy-defelice Jan 17, 2024
47c3d6c
Merge pull request #1348 from Sage-Bionetworks/rs-fix-manifest-requir…
mialy-defelice Jan 17, 2024
366a384
fix test
linglp Jan 18, 2024
8d9ceb2
update data
linglp Jan 18, 2024
30b3177
Merge pull request #1352 from Sage-Bionetworks/develop-fix-test
linglp Jan 18, 2024
2ade117
Merge pull request #1350 from Sage-Bionetworks/rs-fix-manifest-requir…
mialy-defelice Jan 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 246 additions & 11 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pandarallel = "^1.6.4"
schematic-db = {version = "0.0.dev33", extras = ["synapse"]}
pyopenssl = "^23.0.0"
typing-extensions = "<4.6.0"
dataclasses-json = "^0.6.1"

[tool.poetry.group.dev.dependencies]
pytest = "^7.0.0"
Expand Down
3 changes: 0 additions & 3 deletions schematic/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@
"short_help": (
"Convert specification from CSV data model to JSON-LD data model."
),
"base_schema": (
"Path to base data model. BioThings data model is loaded by default."
),
"output_jsonld": (
"Path to where the generated JSON-LD file needs to be outputted."
),
Expand Down
42 changes: 30 additions & 12 deletions schematic/manifest/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
import click
import click_log

from schematic.schemas.data_model_parser import DataModelParser
from schematic.schemas.data_model_graph import DataModelGraph, DataModelGraphExplorer
from schematic.manifest.generator import ManifestGenerator

from schematic.utils.cli_utils import log_value_from_config, query_dict, parse_synIDs
from schematic.help import manifest_commands
from schematic.schemas.generator import SchemaGenerator
from schematic.utils.google_api_utils import export_manifest_csv
from schematic.help import manifest_commands

from schematic.store.synapse import SynapseStorage
from schematic.configuration.configuration import CONFIG

Expand Down Expand Up @@ -59,7 +62,7 @@ def manifest(ctx, config): # use as `schematic manifest ...`
help=query_dict(manifest_commands, ("manifest", "get", "data_type")),
)
@click.option(
"-p", "--jsonld", help=query_dict(manifest_commands, ("manifest", "get", "jsonld"))
"-p", "--path_to_data_model", help=query_dict(manifest_commands, ("manifest", "get", "path_to_data_model"))
)
@click.option(
"-d",
Expand Down Expand Up @@ -104,7 +107,7 @@ def get_manifest(
ctx,
title,
data_type,
jsonld,
path_to_data_model,
dataset_id,
sheet_url,
output_csv,
Expand All @@ -121,17 +124,31 @@ def get_manifest(
if data_type is None:
data_type = CONFIG.manifest_data_type
log_value_from_config("data_type", data_type)
if jsonld is None:
jsonld = CONFIG.model_location
log_value_from_config("jsonld", jsonld)
if path_to_data_model is None:
path_to_data_model = CONFIG.model_location
log_value_from_config("path_to_data_model", path_to_data_model)
if title is None:
title = CONFIG.manifest_title
log_value_from_config("title", title)

data_model_parser = DataModelParser(path_to_data_model = path_to_data_model)

#Parse Model
logger.info("Parsing data model.")
parsed_data_model = data_model_parser.parse_model()

# Instantiate DataModelGraph
data_model_grapher = DataModelGraph(parsed_data_model)

# Generate graph
logger.info("Generating data model graph.")
graph_data_model = data_model_grapher.generate_data_model_graph()

def create_single_manifest(data_type, output_csv=None, output_xlsx=None):
# create object of type ManifestGenerator
manifest_generator = ManifestGenerator(
path_to_json_ld=jsonld,
path_to_data_model=path_to_data_model,
graph = graph_data_model,
title=t,
root=data_type,
use_annotations=use_annotations,
Expand Down Expand Up @@ -174,7 +191,7 @@ def create_single_manifest(data_type, output_csv=None, output_xlsx=None):
logger.info("Find the manifest template using this Google Sheet URL:")
click.echo(result)
if output_csv is None and output_xlsx is None:
prefix, _ = os.path.splitext(jsonld)
prefix, _ = os.path.splitext(path_to_data_model)
prefix_root, prefix_ext = os.path.splitext(prefix)
if prefix_ext == ".model":
prefix = prefix_root
Expand All @@ -194,9 +211,10 @@ def create_single_manifest(data_type, output_csv=None, output_xlsx=None):
if type(data_type) is str:
data_type = [data_type]

if data_type[0] == 'all manifests':
sg = SchemaGenerator(path_to_json_ld=jsonld)
component_digraph = sg.se.get_digraph_by_edge_type('requiresComponent')
if data_type[0] == 'all manifests':
# Feed graph into the data model graph explorer
dmge = DataModelGraphExplorer(graph_data_model)
component_digraph = dmge.get_digraph_by_edge_type('requiresComponent')
components = component_digraph.nodes()
for component in components:
t = f'{title}.{component}.manifest'
Expand Down
86 changes: 54 additions & 32 deletions schematic/manifest/generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections import OrderedDict
import json
import logging
import networkx as nx
from openpyxl.styles import Font, Alignment, PatternFill
from openpyxl import load_workbook
from openpyxl.utils.dataframe import dataframe_to_rows
Expand All @@ -12,7 +13,10 @@
from typing import Dict, List, Optional, Tuple, Union, BinaryIO, Literal
from flask import send_from_directory

from schematic.schemas.generator import SchemaGenerator
from schematic.schemas.data_model_graph import DataModelGraph, DataModelGraphExplorer
from schematic.schemas.data_model_parser import DataModelParser
from schematic.schemas.data_model_json_schema import DataModelJSONSchema

from schematic.utils.google_api_utils import (
execute_google_api_requests,
build_service_account_creds,
Expand All @@ -35,7 +39,8 @@
class ManifestGenerator(object):
def __init__(
self,
path_to_json_ld: str, # JSON-LD file to be used for generating the manifest
path_to_data_model: str, # JSON-LD file to be used for generating the manifest
graph: nx.MultiDiGraph, # At this point, the graph is fully formed.
alphabetize_valid_values: str = 'ascending',
title: str = None, # manifest sheet title
root: str = None,
Expand All @@ -54,6 +59,12 @@ def __init__(
# google service credentials object
self.creds = services_creds["creds"]

# Path to jsonld
self.model_path = path_to_data_model

# Graph
self.graph = graph

# schema root
if root:
self.root = root
Expand All @@ -79,14 +90,14 @@ def __init__(
"when there is no manifest file for the dataset in question."
)

# SchemaGenerator() object
self.sg = SchemaGenerator(path_to_json_ld)
# Instantiate Data Model Explorer object
self.dmge = DataModelGraphExplorer(self.graph)

# additional metadata to add to manifest
self.additional_metadata = additional_metadata

# Check if the class is in the schema
root_in_schema = self.sg.se.is_class_in_schema(self.root)
root_in_schema = self.dmge.is_class_in_schema(self.root)

# If the class could not be found, give a notification
if not root_in_schema:
Expand All @@ -95,8 +106,7 @@ def __init__(
raise LookupError(exception_message)

# Determine whether current data type is file-based
self.is_file_based = "Filename" in self.sg.get_node_dependencies(self.root)

self.is_file_based = "Filename" in self.dmge.get_node_dependencies(self.root)

def _attribute_to_letter(self, attribute, manifest_fields):
"""Map attribute to column letter in a google sheet"""
Expand Down Expand Up @@ -364,13 +374,12 @@ def _get_json_schema(self, json_schema_filepath: str) -> Dict:
json_schema_filepath(str): path to json schema file
Returns:
Dictionary, containing portions of the json schema
TODO: Do we even allow people to provide a json_schema_filepath anyore?
"""
if not json_schema_filepath:
# if no json schema is provided; there must be
# schema explorer defined for schema.org schema
# o.w. this will throw an error
# TODO: catch error
json_schema = self.sg.get_json_schema_requirements(self.root, self.title)
# TODO Catch error if no JSONLD or JSON path provided.
data_model_js = DataModelJSONSchema(jsonld_path=self.model_path, graph=self.graph)
json_schema = data_model_js.get_json_validation_schema(source_node=self.root, schema_name=self.title)
else:
with open(json_schema_filepath) as jsonfile:
json_schema = json.load(jsonfile)
Expand Down Expand Up @@ -813,9 +822,9 @@ def _request_row_format(self, i, req):
notes_body["requests"] (dict): with information on note
to add to the column header. This notes body will be added to a request.
"""
if self.sg.se:
if self.dmge:
# get node definition
note = self.sg.get_node_definition(req)
note = self.dmge.get_node_comment(node_display_name = req)

notes_body = {
"requests": [
Expand Down Expand Up @@ -1014,8 +1023,7 @@ def _dependency_formatting(
dependency_formatting_body = {"requests": []}
for j, val_dep in enumerate(val_dependencies):
is_required = False

if self.sg.is_node_required(val_dep):
if self.dmge.get_node_required(node_display_name=val_dep):
is_required = True
else:
is_required = False
Expand Down Expand Up @@ -1058,13 +1066,13 @@ def _request_dependency_formatting(
for req_val in req_vals:
# get this required/valid value's node label in schema, based on display name (i.e. shown to the user in a dropdown to fill in)
req_val = req_val["userEnteredValue"]
req_val_node_label = self.sg.get_node_label(req_val)
req_val_node_label = self.dmge.get_node_label(req_val)
if not req_val_node_label:
# if this node is not in the graph
# continue - there are no dependencies for it
continue
# check if this required/valid value has additional dependency attributes
val_dependencies = self.sg.get_node_dependencies(
val_dependencies = self.dmge.get_node_dependencies(
req_val_node_label, schema_ordered=False
)

Expand Down Expand Up @@ -1117,7 +1125,7 @@ def _create_requests_body(
requests_body["requests"] = []
for i, req in enumerate(ordered_metadata_fields[0]):
# Gather validation rules and valid values for attribute.
validation_rules = self.sg.get_node_validation_rules(req)
validation_rules = self.dmge.get_node_validation_rules(node_display_name=req)

# Add regex match validaiton rule to Google Sheets.
if validation_rules and sheet_url:
Expand Down Expand Up @@ -1364,7 +1372,7 @@ def map_annotation_names_to_display_names(
pd.DataFrame: Annotations table with updated column headers.
"""
# Get list of attribute nodes from data model
model_nodes = self.sg.se.get_nx_schema().nodes
model_nodes = self.graph.nodes

# Subset annotations to those appearing as a label in the model
labels = filter(lambda x: x in model_nodes, annotations.columns)
Expand Down Expand Up @@ -1492,7 +1500,7 @@ def _handle_output_format_logic(self, output_format: str = None, output_path: st
return dataframe

@staticmethod
def create_single_manifest(jsonld: str, data_type: str, access_token:Optional[str]=None, dataset_id:Optional[str]=None, strict:Optional[bool]=True, title:Optional[str]=None, output_format:Literal["google_sheet", "excel", "dataframe"]="google_sheet", use_annotations:Optional[bool]=False) -> Union[str, pd.DataFrame, BinaryIO]:
def create_single_manifest(path_to_data_model: str, graph_data_model: nx.MultiDiGraph, data_type: str, access_token:Optional[str]=None, dataset_id:Optional[str]=None, strict:Optional[bool]=True, title:Optional[str]=None, output_format:Literal["google_sheet", "excel", "dataframe"]="google_sheet", use_annotations:Optional[bool]=False) -> Union[str, pd.DataFrame, BinaryIO]:
"""Create a single manifest

Args:
Expand All @@ -1510,7 +1518,8 @@ def create_single_manifest(jsonld: str, data_type: str, access_token:Optional[st
"""
# create object of type ManifestGenerator
manifest_generator = ManifestGenerator(
path_to_json_ld=jsonld,
path_to_data_model=path_to_data_model,
graph=graph_data_model,
title=title,
root=data_type,
use_annotations=use_annotations,
Expand All @@ -1536,11 +1545,11 @@ def create_single_manifest(jsonld: str, data_type: str, access_token:Optional[st
return result

@staticmethod
def create_manifests(jsonld:str, data_types:list, access_token:Optional[str]=None, dataset_ids:Optional[list]=None, output_format:Literal["google_sheet", "excel", "dataframe"]="google_sheet", title:Optional[str]=None, strict:Optional[bool]=True, use_annotations:Optional[bool]=False) -> Union[List[str], List[pd.DataFrame], BinaryIO]:
def create_manifests(path_to_data_model:str, data_types:list, access_token:Optional[str]=None, dataset_ids:Optional[list]=None, output_format:Literal["google_sheet", "excel", "dataframe"]="google_sheet", title:Optional[str]=None, strict:Optional[bool]=True, use_annotations:Optional[bool]=False) -> Union[List[str], List[pd.DataFrame], BinaryIO]:
"""Create multiple manifests

Args:
jsonld (str): jsonld schema
path_to_data_model (str): str path to data model
data_type (list): a list of data types
access_token (str, optional): synapse access token. Required when getting an existing manifest. Defaults to None.
dataset_id (list, optional): a list of dataset ids when generating an existing manifest. Defaults to None.
Expand All @@ -1552,18 +1561,30 @@ def create_manifests(jsonld:str, data_types:list, access_token:Optional[str]=Non
Returns:
Union[List[str], List[pd.DataFrame], BinaryIO]: a list of Googlesheet URLs, a list of pandas dataframes or an Excel file.
"""
data_model_parser = DataModelParser(path_to_data_model = path_to_data_model)

#Parse Model
parsed_data_model = data_model_parser.parse_model()

# Instantiate DataModelGraph
data_model_grapher = DataModelGraph(parsed_data_model)

# Generate graph
graph_data_model = data_model_grapher.generate_data_model_graph()

# Gather all returned result urls
all_results = []
if data_types[0] == 'all manifests':
sg = SchemaGenerator(path_to_json_ld=jsonld)
component_digraph = sg.se.get_digraph_by_edge_type('requiresComponent')
dmge = DataModelGraphExplorer(graph_data_model)
component_digraph = dmge.get_digraph_by_edge_type('requiresComponent')
components = component_digraph.nodes()
for component in components:
if title:
t = f'{title}.{component}.manifest'
else:
t = f'Example.{component}.manifest'
if output_format != "excel":
result = ManifestGenerator.create_single_manifest(jsonld=jsonld, data_type=component, output_format=output_format, title=t, access_token=access_token, strict=strict, use_annotations=use_annotations)
result = ManifestGenerator.create_single_manifest(path_to_data_model=path_to_data_model, data_type=component, graph_data_model=graph_data_model, output_format=output_format, title=t, access_token=access_token)
all_results.append(result)
else:
logger.error('Currently we do not support returning multiple files as Excel format at once. Please choose a different output format. ')
Expand All @@ -1578,9 +1599,9 @@ def create_manifests(jsonld:str, data_types:list, access_token:Optional[str]=Non
t = title
if dataset_ids:
# if a dataset_id is provided add this to the function call.
result = ManifestGenerator.create_single_manifest(jsonld=jsonld, data_type=dt, dataset_id=dataset_ids[i], output_format=output_format, title=t, access_token=access_token, strict=strict, use_annotations=use_annotations)
result = ManifestGenerator.create_single_manifest(path_to_data_model=path_to_data_model, data_type=dt, graph_data_model=graph_data_model, dataset_id=dataset_ids[i], output_format=output_format, title=t, access_token=access_token, use_annotations=use_annotations)
else:
result = ManifestGenerator.create_single_manifest(jsonld=jsonld, data_type=dt, output_format=output_format, title=t, access_token=access_token, strict=strict, use_annotations=use_annotations)
result = ManifestGenerator.create_single_manifest(path_to_data_model=path_to_data_model, data_type=dt, graph_data_model=graph_data_model, output_format=output_format, title=t, access_token=access_token, use_annotations=use_annotations)

# if output is pandas dataframe or google sheet url
if isinstance(result, str) or isinstance(result, pd.DataFrame):
Expand All @@ -1589,6 +1610,7 @@ def create_manifests(jsonld:str, data_types:list, access_token:Optional[str]=Non
if len(data_types) > 1:
logger.warning(f'Currently we do not support returning multiple files as Excel format at once. Only {t} would get returned. ')
return result

return all_results


Expand Down Expand Up @@ -1632,7 +1654,7 @@ def get_manifest(

# Get manifest file associated with given dataset (if applicable)
# populate manifest with set of new files (if applicable)
manifest_record = store.updateDatasetManifestFiles(self.sg, datasetId = dataset_id, store = False)
manifest_record = store.updateDatasetManifestFiles(self.dmge, datasetId = dataset_id, store = False)

# get URL of an empty manifest file created based on schema component
empty_manifest_url = self.get_empty_manifest(strict=strict, sheet_url=True)
Expand Down Expand Up @@ -1869,9 +1891,9 @@ def sort_manifest_fields(self, manifest_fields, order="schema"):

# order manifest fields based on data-model schema
if order == "schema":
if self.sg and self.root:
if self.dmge and self.root:
# get display names of dependencies
dependencies_display_names = self.sg.get_node_dependencies(self.root)
dependencies_display_names = self.dmge.get_node_dependencies(self.root)

# reorder manifest fields so that root dependencies are first and follow schema order
manifest_fields = sorted(
Expand Down
Loading
Loading