diff --git a/CHANGELOG.md b/CHANGELOG.md index 66259e5..392c223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## [unreleased] ### Added - An endpoint `/apitest-status` that returns a response containing a link to the eventual json file with the submissions data errors +### Changed +- Renamed `/validate` endpoint to `/apitest` ## [2.5.2] ### Fixed diff --git a/README.md b/README.md index ddf7ed5..22de14f 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ Transforms csv submission files (Variant.csv and CaseData.csv) into a json submi Proxy endpoint to the ClinVar submissions API (dry-run): https://submit.ncbi.nlm.nih.gov/api/v1/submissions/?dry-run=true. Requires a valid API key and a json file containing a submission object. If the request is valid (and the json submission object is validated) returns a response with code 200 and json body with the message value "success". -### validate +### apitest -Proxy endpoint to the ClinVar validate API endpoint: "https://submit.ncbi.nlm.nih.gov/apitest/v1/submissions". Requires a valid API key and a json file containing a submission object. If the json submission document is valid returns a submission ID which can be used for a real submission. If the json submission document is not validated, the endpoint returns a list of errors which will help fixing the document. +Proxy endpoint to the validation API endpoint: (apitest) "https://submit.ncbi.nlm.nih.gov/apitest/v1/submissions". Requires a valid API key and a json file containing a submission object. If the json submission document is valid returns a submission ID which can be used for a real submission. If the json submission document is not validated, the endpoint returns a list of errors which will help fixing the document. ## Running the application using Docker-compose An example containing a demo setup for the app is included in the docker-compose file. Start the docker-compose demo using this command: diff --git a/preClinVar/main.py b/preClinVar/main.py index c37259f..6324990 100644 --- a/preClinVar/main.py +++ b/preClinVar/main.py @@ -49,8 +49,8 @@ async def apitest_status(api_key: str = Form(), submission_id: str = Form()) -> ) -@app.post("/validate") -async def validate(api_key: str = Form(), json_file: UploadFile = File(...)): +@app.post("/apitest") +async def apitest(api_key: str = Form(), json_file: UploadFile = File(...)): """A proxy to the apitest ClinVar API endpoint""" # Create a submission header header = build_header(api_key) diff --git a/tests/test_main.py b/tests/test_main.py index 0e4abe6..acb37e3 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -290,8 +290,8 @@ def test_dry_run(): @responses.activate -def test_validate_wrong_api_key(): - """Test the validate API proxy endpoint without a valid ClinVar API key""" +def test_apitest_wrong_api_key(): + """Test the apitest API proxy endpoint without a valid ClinVar API key""" # GIVEN a json submission file json_file = {"json_file": open(subm_json_path, "rb")} @@ -304,7 +304,7 @@ def test_validate_wrong_api_key(): status=401, # The ClinVar API returs code 201 when request is successful (created) ) - response = client.post("/validate", data={"api_key": DEMO_API_KEY}, files=json_file) + response = client.post("/apitest", data={"api_key": DEMO_API_KEY}, files=json_file) # THEN the ClinVar API should return "unauthorized" assert response.status_code == 401 # Not authorized @@ -312,8 +312,8 @@ def test_validate_wrong_api_key(): @responses.activate -def test_validate(): - """Test the endpoint validate, a proxy to ClinVar apitest, with a mocked ClinVar API response.""" +def test_apitest(): + """Tests the endpoint apitest, a proxy to ClinVar apitest, with a mocked ClinVar API response.""" # GIVEN a json submission file json_file = {"json_file": open(subm_json_path, "rb")} @@ -326,7 +326,7 @@ def test_validate(): status=201, # The ClinVar API returs code 201 when request is successful (created) ) - response = client.post("/validate", data={"api_key": DEMO_API_KEY}, files=json_file) + response = client.post("/apitest", data={"api_key": DEMO_API_KEY}, files=json_file) # THEN the ClinVar API proxy should return "success" assert response.status_code == 201 # Created