Skip to content

Commit 3d5a4ef

Browse files
authored
Merge pull request #877 from Sage-Bionetworks/develop
Release 22.8.1
2 parents 9f582f2 + 0c135b5 commit 3d5a4ef

29 files changed

+1249
-990
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,23 @@ jobs:
8383
#----------------------------------------------
8484
# run test suite
8585
#----------------------------------------------
86-
- name: Run tests
86+
- name: Run regular tests and rule combination tests
8787
env:
8888
SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }}
89+
if: ${{ contains(github.event.head_commit.message, 'runcombos') }}
8990
run: >
90-
source .venv/bin/activate;
91+
source .venv/bin/activate;
9192
pytest --cov-report=term --cov-report=html:htmlcov --cov=schematic/
9293
-m "not google_credentials_needed"
94+
95+
- name: Run tests
96+
env:
97+
SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }}
98+
if: ${{ false == contains(github.event.head_commit.message, 'runcombos') }}
99+
run: >
100+
source .venv/bin/activate;
101+
pytest --cov-report=term --cov-report=html:htmlcov --cov=schematic/
102+
-m "not (google_credentials_needed or rule_combos)"
93103
94104
- name: Upload pytest test results
95105
uses: actions/upload-artifact@v2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,5 @@ great_expectations/expectations/Manifest_test_suite.json
168168

169169
tests/data/example.MockComponent.schema.json
170170
tests/data/mock_manifests/Invalid_Test_Manifest_censored.csv
171+
tests/data/mock_manifests/valid_test_manifest_censored.csv
172+
tests/data/mock_manifests/Rule_Combo_Manifest_censored.csv

RELEASE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ Once the code has been merged into the `develop` branch on this repo, there are
55
- You should create a GitHub [tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging), with the appropriate version number. Typically, from `v21.06` onwards all tags are created following the Linux Ubuntu versioning convention which is the `YY.MM` format where `Y` is the year and `M` is the month of that year when that release was created.
66
- You should push the package to [PyPI](https://pypi.org/). Schematic is on PyPI as [schematicpy](https://pypi.org/project/schematicpy/). You can go through the following two sections for that.
77

8+
## Steps
9+
- Step 1: Open a pull request to merge the `main` branch to the `develop` branch:
10+
- Click on the "Pull Request" tab on Github
11+
- Click on the green button "New pull request"
12+
- Select `main` as "base" and `develop` as "compare"
13+
- Resolve conflicts
14+
- Link all PRs and/or issues that are included in the release (example [here](https://github.com/Sage-Bionetworks/data_curator/pull/357))
15+
16+
- Step 2: Create a tag
17+
`git tag <tag version> -m '<message>'`
18+
19+
- Step 3: Push the tag to main branch (this step assumes that you have checked out the main branch locally)
20+
`git push origin <tag version>`
21+
22+
This should trigger the PYPI release workflow and release a new version of schematic to PYPI. You could check by cliking on the GitHub action log and login to your PYPI account (and select project `schematicpy`. Please note that you have to obtain access to `schematicpy` to be able to see it.)
23+
24+
>Note: if you make some mistakes and would like to delete a tag, try the following commands: `git push --delete origin <version number>` for deleting a tag remotely and `git tag -d <version number>` for deleting a tag locally.
25+
26+
827
## Release to Test PyPI _(optional)_
928

1029
The purpose of this section is to verify that the package looks and works as intended, by viewing it on [Test PyPI](https://test.pypi.org/) and installing the test version in a separate virtual environment.

api/openapi/api.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,43 @@ paths:
350350
description: Check schematic log
351351
tags:
352352
- Manifest Operations
353+
/get/datatype/manifest:
354+
get:
355+
summary: Retrieve asset view table as a dataframe.
356+
description: Retrieve asset view table as a dataframe.
357+
operationId: api.routes.get_manifest_datatype
358+
parameters:
359+
- in: query
360+
name: input_token
361+
schema:
362+
type: string
363+
nullable: false
364+
description: Token
365+
example: Token
366+
required: true
367+
- in: query
368+
name: asset_view
369+
schema:
370+
type: string
371+
nullable: false
372+
description: ID of view listing all project data assets. For example, for Synapse this would be the Synapse ID of the fileview listing all data assets for a given project.(i.e. master_fileview in config.yml)
373+
example: syn23643253
374+
required: true
375+
- in: query
376+
name: manifest_id
377+
schema:
378+
type: string
379+
nullable: false
380+
description: Manifest ID
381+
example: syn27600110
382+
required: true
383+
responses:
384+
"200":
385+
description: A list of json
386+
"500":
387+
description: Check schematic log.
388+
tags:
389+
- Manifest Operations
353390
/storage/projects:
354391
get:
355392
summary: Get all storage projects the current user has access to

api/routes.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from schematic.store.synapse import SynapseStorage
1919
import pandas as pd
2020
import json
21+
from schematic.utils.df_utils import load_df
2122

2223

2324
# def before_request(var1, var2):
@@ -169,11 +170,13 @@ def validate_manifest_route(schema_url, data_type):
169170
inputMModelLocation=jsonld, inputMModelLocationType="local"
170171
)
171172

172-
errors = metadata_model.validateModelManifest(
173+
errors, warnings = metadata_model.validateModelManifest(
173174
manifestPath=temp_path, rootNode=data_type
174175
)
176+
177+
res_dict = {"errors": errors, "warnings": warnings}
175178

176-
return errors
179+
return res_dict
177180

178181

179182
def submit_manifest_route(schema_url, manifest_record_type=None):
@@ -199,7 +202,7 @@ def submit_manifest_route(schema_url, manifest_record_type=None):
199202
validate_component = data_type
200203

201204
manifest_id = metadata_model.submit_metadata_manifest(
202-
manifest_path=temp_path, dataset_id=dataset_id, validate_component=validate_component, input_token=input_token, manifest_record_type = manifest_record_type, restrict_rules = restrict_rules)
205+
path_to_json_ld = schema_url, manifest_path=temp_path, dataset_id=dataset_id, validate_component=validate_component, input_token=input_token, manifest_record_type = manifest_record_type, restrict_rules = restrict_rules)
203206

204207
return manifest_id
205208

@@ -318,4 +321,19 @@ def get_project_manifests(input_token, project_id, asset_view):
318321
lst_manifest = store.getProjectManifests(projectId=project_id)
319322

320323
return lst_manifest
321-
324+
325+
def get_manifest_datatype(input_token, manifest_id, asset_view):
326+
# use the default asset view from config
327+
config_handler(asset_view=asset_view)
328+
329+
# use Synapse Storage
330+
store = SynapseStorage(input_token=input_token)
331+
332+
# get data types of an existing manifest
333+
manifest_dtypes_dict= store.getDataTypeFromManifest(manifest_id)
334+
335+
336+
return manifest_dtypes_dict
337+
338+
339+

0 commit comments

Comments
 (0)