Skip to content

Commit

Permalink
clean up project to re-release as graph-validation-test-runners relea…
Browse files Browse the repository at this point in the history
…se 0.0.12
  • Loading branch information
RichardBruskiewich committed May 7, 2024
1 parent 63c1944 commit 41e0f84
Show file tree
Hide file tree
Showing 8 changed files with 1,250 additions and 153 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 0.0.12

- repository generally renamed to graph-validation-test-runners (but propagate current version)
- renamed various TestRunner packages to have suffix "_runner"
- repair some technical debt; patch unit tests


## 0.0.11 (reissued 0.0.10)

- Update reasoner-validator to 4.1.2
Expand Down
8 changes: 4 additions & 4 deletions DEVELOPER_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Steps to properly issue a new project release:

1. Run the unit test suite to ensure that nothing fails. Iterate to fix failures (in the code or in terms of revised unit tests to reflect fresh code designs)
2. Document release changes in the **CHANGELOG.md**
3. Update the **`[Tool Poetry]version =`** field in the **pyprojects.yaml**, e.g. "0.0.10"
3. Update the **`[Tool Poetry]version =`** field in the **pyprojects.yaml**, e.g. "0.0.12"
4. Run **`poetry update`** (preferably, within a **`poetry shell`**)
5. The project pip **requirements.txt** file snapshot of dependencies should also be updated at this point (type **`$ poetry export --output requirements.txt`**, assuming that the [proper poetry export plugin is installed](https://python-poetry.org/docs/pre-commit-hooks#poetry-export)). This may facilitate module deployment within environments that prefer to use pip rather than poetry to manage their deployments.
6. Commit or pull request merge all files (including the **poetry.lock** file) to the local **main** branch.
7. Add the equivalent Git **tag** to **main**. This should be the Semantic Version string from step 4 with an added 'v' prefix, e.g. "v0.0.10".
7. Add the equivalent Git **tag** to **main**. This should be the Semantic Version string from step 4 with an added 'v' prefix, e.g. "v0.0.12".
8. Push **main** to remote.
9. Check if Git Actions for testing and documentation complete successfully.
10. Create a Git package release using the same release tag, e.g. "v0.0.10".
11. Check if Git Actions for package deployment is successful and check if the new version (e.g. "v0.0.10") is now visible on **[pypy.org](https://pypi.org/search/?q=OneHopTests)**
10. Create a Git package release using the same release tag, e.g. "v0.0.12".
11. Check if Git Actions for package deployment is successful and check if the new version (e.g. "v0.0.12") is now visible on **[pypy.org](https://pypi.org/search/?q=OneHopTests)**
84 changes: 40 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Graph Validation Tests

[![Pyversions](https://img.shields.io/pypi/pyversions/reasoner-validator)](https://pypi.python.org/pypi/OneHopTests)
[![Publish Python Package](https://github.com/TranslatorSRI/OneHopTests/actions/workflows/python-publish.yml/badge.svg)](https://pypi.org/project/OneHopTests/)
[![Pyversions](https://img.shields.io/pypi/pyversions/graph-validation-test-runners)](https://pypi.python.org/pypi/graph-validation-test-runners)
[![Publish Python Package](https://github.com/TranslatorSRI/graph-validation-test-runners/actions/workflows/python-publish.yml/badge.svg)](https://pypi.org/project/graph-validation-tests-runners/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Run tests](https://github.com/TranslatorSRI/OneHopTests/actions/workflows/test.yml/badge.svg)](https://github.com/TranslatorSRI/OneHopTests/actions/workflows/test.yml)
[![Run tests](https://github.com/TranslatorSRI/graph-validation-test-runners/actions/workflows/test.yml/badge.svg)](https://github.com/TranslatorSRI/graph-validation-test-runners/actions/workflows/test.yml)


This repository provides the implementation of Translator knowledge graph validation test runners within the new 2023 Testing Infrastructure. The current package currently contains two such test runners:

- **StandardsValidationTest:** is a wrapper of the [Translator reasoner-validator package](https://github.com/NCATSTranslator/reasoner-validator) which certifies that knowledge graph data access is TRAPI compliant and the graph semantic content is Biolink Model compliant.
- **OneHopTest:** is a slimmed down excerpt of "One Hop" knowledge graph navigation unit test code from the legacy [SRI_Testing test harness](https://github.com/TranslatorSRI/SRI_testing), code which validates that single hop TRAPI lookup queries on a Translator knowledge graph, meet basic expectation of input test edge data recovery in the output, using several diverse kinds of templated TRAPI queries. Unlike **SR_Testing**, the **OneHopTest** module retrieves its test data directly from the new [NCATS Translator Tests](https://github.com/NCATSTranslator/Tests) repository.
- **OneHopTest:** is a slimmed down excerpt of "One Hop" knowledge graph navigation unit test code from the legacy [SRI_Testing test harness](https://github.com/TranslatorSRI/SRI_testing), code which validates that single hop TRAPI lookup queries on a Translator knowledge graph, meet basic expectation of input test edge data recovery in the output, using several diverse kinds of templated TRAPI queries. Unlike **SRI_Testing**, the **graph-validation-test-runners** TestRunners uses test data directly from the new [NCATS Translator Tests](https://github.com/NCATSTranslator/Tests) repository.

Programmatically, the command line or programmatic parameters to each kind of test are identical, but the underlying Test Cases (derived from the source Test Assets) is the same.

## Usage

The **StandardsValidationTest** and **OneHopTest** test runners may be run directly from the command line or programmatically, from within a Python script.
The **standards_validation_test_runner** and **one_hop_test_runner* may be run directly from the command line or programmatically, from within a Python script.

### Installation

The **graph-validation-tests** module can be installed from pypi and used as part of the Translator-wide automated testing.
The **graph-validation-test-runners** module can be installed from pypi and used as part of the Translator-wide automated testing.

_Note: Requires 3.9 <= Python release <= 3.12_

Expand All @@ -29,15 +29,15 @@ From within your target working directory:

- Create a python virtual environment: `python -m venv venv`
- Activate your environment: `. ./venv/bin/activate`
- Install dependencies: `pip install graph-validation-tests`
- Install dependencies: `pip install graph-validation-test-runners`

then proceed with [command line execution](#cli) or [script level execution](#programmatic-level-execution).

#### From GitHub

You can also check out the project from GitHub. If you do that, the installation process will be slightly different, since the project itself uses [Poetry](https://python-poetry.org/) for dependency management - the following instructions assume that you've [installed Poetry on your system](https://python-poetry.org/docs/#installation).

- Check out the code: `git checkout https://github.com/TranslatorSRI/graph-validation-tests.git`
- Check out the code: `git checkout https://github.com/TranslatorSRI/graph-validation-test-runners.git`
- Create a Poetry shell: `poetry shell`
- Install dependencies: `poetry install`

Expand All @@ -56,7 +56,7 @@ or
$ one_hop_test_runner --help
```

should give usage instructions as follows (where <tool name> is either 'standards_validation_test' or 'one_hop_test'):
should give usage instructions as follows (where <tool name> is either 'standards_validation_test_runner' or 'one_hop_test_runner'):

```shell
usage: <tool name> [-h] [--components COMPONENTS] [--environment {dev,ci,test,prod}] --subject_id SUBJECT_ID --predicate_id PREDICATE_ID
Expand Down Expand Up @@ -103,10 +103,7 @@ test_data = {
"predicate_id": "biolink:has_side_effect",
"object_id": "MONDO:0011426",
"object_category": "biolink:Disease",
"components": [
ComponentEnum("arax"),
ComponentEnum("molepro")
]
"components": ["arax", "molepro"]
# "environment": environment, # Optional[TestEnvEnum] = None; default: 'TestEnvEnum.ci' if not given
# "trapi_version": trapi_version, # Optional[str] = None; latest community release if not given
# "biolink_version": biolink_version, # Optional[str] = None; current Biolink Toolkit default if not given
Expand All @@ -116,7 +113,7 @@ results: Dict = asyncio.run(run_standards_validation_tests(**test_data))
print(results)
```

### OneHopTest
### One Hop Test

To run "One Hop" knowledge graph navigation tests validating query outputs from a knowledge graph TRAPI component:

Expand Down Expand Up @@ -203,40 +200,40 @@ This is a sample of what the JSON output from test runs currently looks like (th
"molepro": "molepro"
},
"results": {
"TestAsset_1-by_subject": {
"molepro": {
"status": "FAILED",
"messages": {
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset_1|(CHEBI:58579#biolink:SmallMolecule)-[biolink:is_active_metabolite_of]->(UniProtKB:Q9NQ88#biolink:Protein)": null
}
}
}
"TestAsset_1-by_subject": {
"molepro": {
"status": "FAILED",
"messages": {
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset_1|(CHEBI:58579#biolink:SmallMolecule)-[biolink:is_active_metabolite_of]->(UniProtKB:Q9NQ88#biolink:Protein)": null
}
}
}
},
"TestAsset_1-inverse_by_new_subject": {
"molepro": {
"status": "FAILED",
"messages": {
"critical": {
"critical.trapi.request.invalid": {
"global": {
"predicate 'biolink:is_active_metabolite_of'": [
{
"context": "inverse_by_new_subject",
"reason": "is an unknown or has no inverse?"
}
]
}
}
}
}
},
"TestAsset_1-inverse_by_new_subject": {
"molepro": {
"status": "FAILED",
"messages": {
"critical": {
"critical.trapi.request.invalid": {
"global": {
"predicate 'biolink:is_active_metabolite_of'": [
{
"context": "inverse_by_new_subject",
"reason": "is an unknown or has no inverse?"
}
]
}
}
}
},
# etc...
}
}
}
}
}
```

Expand All @@ -247,4 +244,3 @@ A [full change log](CHANGELOG.md) is provided documenting each release, but we s
### v0.0.\* Releases

- This initial code release only supports testing of [Translator SmartAPI Registry](https://smart-api.info/registry/translator) catalogued components which are TRAPI implementations for Translator Autonomous Relay Agent (ARA) and Knowledge Providers (KP), but _not_ direct testing of the Translator Autonomous Relay System (ARS) or Translator user interface (UI)
- Standards validation tests currently calls release 4.0.0 of the [reasoner-validator](https://github.com/NCATSTranslator/reasoner-validator), which is currently limited to TRAPI release 1.4.2 validation (not yet the recent TRAPI 1.5.0 releases)
Loading

0 comments on commit 41e0f84

Please sign in to comment.