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

Write tests for cam-pipeline #94

Closed
gaurav opened this issue May 12, 2023 · 1 comment · Fixed by #111
Closed

Write tests for cam-pipeline #94

gaurav opened this issue May 12, 2023 · 1 comment · Fixed by #111

Comments

@gaurav
Copy link
Member

gaurav commented May 12, 2023

Probably the simplest way of doing this would be to add tests to Souffle so that invalid or suspicious edges are reported somewhere (e.g. any edge that isn't mapped to a Biolink predicate).

We should also set up a test kit in this repository that can query the TRAPI endpoint and confirm that it is working correctly. We have code for doing that in https://github.com/ExposuresProvider/cam-kp-api/, so we could try moving that over in Scala/ZIO or rewriting it into Souffle/Python/something simple.

@gaurav
Copy link
Member Author

gaurav commented Oct 19, 2023

Moving over the existing code is going to be a pain, because it has deep dependencies with ZIO testing, Circe and the code in cam-kp-api that models the TRAPI messages.

Instead, I think the right approach needs to be:

  1. Use https://automat.renci.org/cam-kp/1.4/sri_testing_data to download example data.
  2. Build a Scala-CLI ZIO module for querying Automat-CAM-KP with a simple query (see below for some examples) via the /query endpoint.
  3. Create test files for the ZIO module which uses it to query an Automat-CAM-KP instance with some example data and compare the output to the expected output.
  4. Initially this will focus on our primary customer, ICEES (see CAM KP does not respond to any of ICEES KG-derived input CURIES #101 and ICEES+ / ICEES KG - CAM - AOP Integration cam-kp-api#599), but eventually we expect to enhance these tests as cam-pipeline itself improves.

An example of a simple query that works against Automat CAM-KP (i.e. by running curl -X POST "https://automat.renci.org/cam-kp/1.4/query" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"message\":{\"query_graph\":{\"nodes\":{\"n0\":{\"categories\":[\"biolink:Gene\"],\"ids\":[\"NCBIGene:13870\"]},\"n1\":{\"categories\":[\"biolink:BiologicalProcess\"]}},\"edges\":{\"e01\":{\"subject\":\"n0\",\"object\":\"n1\",\"predicates\":[\"biolink:causes\"]}}}}}"):

{
    "message": {
        "query_graph": {
            "nodes": {
                "n0": {
                    "categories": ["biolink:Gene"],
                    "ids": ["NCBIGene:13870"]
                },
                "n1": {
                    "categories": ["biolink:BiologicalProcess"]
                }
            },
            "edges": {
                "e01": {
                    "subject": "n0",
                    "object": "n1",
                    "predicates": ["biolink:causes"]
                }
            }
        }
    }
}

@gaurav gaurav added this to the CAM-KP November 2023 milestone Nov 11, 2023
gaurav added a commit that referenced this issue Feb 13, 2024
This PR adds a test suite in Python for CAM-KP-API to cam-pipeline. Some of this code has been moved over from https://github.com/ExposuresProvider/cam-kp-api and the rest has been newly written for this.

There are three tests here:
- test_api.py: test the Automat-CAM-KP API endpoints.
- test_examples.py: tests the example files in `examples/`.
- test_curies.py: test a set of CURIEs to see if Automat-CAM-KP has information or not about them. This currently includes failing tests from #101

I tried to move over the integration tests from CAM-KP-API, but I couldn't work out the easiest way to figure out how to move them over as a Scala project. I think these Python tests are easier to read and maintain, but I'm happy to be proved wrong.

Closes #94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant