Skip to content

Commit 105646f

Browse files
committed
Add in if else to skip some data models
1 parent b60b398 commit 105646f

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

scripts/write_jsonschemas_to_table.py

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,43 @@ def main():
2222
- link: a link to the JSONschema version in the Synapse repo
2323
"""
2424
syn = synapseclient.login()
25+
# json_schema_organizations = ["sage.schemas.v2571", "sage.schemas.v2581"]
2526
json_schema_organizations = ["sage.schemas.v2571", "sage.schemas.v2581"]
2627
js = syn.service("json_schema")
2728
to_write_schemas = []
2829
for organization_name in json_schema_organizations:
2930
org = js.JsonSchemaOrganization(organization_name)
3031
schemas = org.list_json_schemas()
3132
for schema in schemas:
33+
print(schema)
3234
versions = schema.list_versions()
33-
for version in versions:
34-
to_write_schemas.append(
35-
{
36-
"org": organization_name,
37-
"name": version.name,
38-
"dcc": version.name.split(".")[0],
39-
"datatype": version.name.split(".")[1],
40-
"uri": version.uri,
41-
"version": version.semantic_version,
42-
"link": f"https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/{version.uri}",
43-
}
44-
)
35+
try:
36+
for version in versions:
37+
if (
38+
(
39+
version.name.startswith("ad")
40+
and version.semantic_version == "0.1.0"
41+
)
42+
or (
43+
version.name.startswith("el")
44+
and version.semantic_version == "0.0.1"
45+
)
46+
or ".validation." in version.name
47+
):
48+
continue
49+
to_write_schemas.append(
50+
{
51+
"org": organization_name,
52+
"name": version.name,
53+
"dcc": version.name.split(".")[0],
54+
"datatype": version.name.split(".")[1],
55+
"uri": version.uri,
56+
"version": version.semantic_version,
57+
"link": f"https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/{version.uri}",
58+
}
59+
)
60+
except Exception as e:
61+
print(e)
4562

4663
df = pd.DataFrame(to_write_schemas)
4764
# exclude HTAN1, HTAN2, and NF schemas as they have their own JSONschema organizations

0 commit comments

Comments
 (0)