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

G3 226 add publication endpoint #62

Merged
merged 5 commits into from
May 2, 2024
Merged

Conversation

francastell
Copy link
Collaborator

No description provided.

Copy link

github-actions bot commented May 1, 2024

Test Coverage Report

============================= test session starts ==============================
platform linux -- Python 3.11.9, pytest-8.2.0, pluggy-1.5.0
rootdir: /home/runner/work/geneweaver-api/geneweaver-api
configfile: pyproject.toml
plugins: asyncio-0.21.2, anyio-4.3.0, cov-4.1.0
asyncio: mode=Mode.STRICT
collected 195 items

tests/controllers/test_api_standards.py ................................ [ 16%]
......................................ssssssssssssss                     [ 43%]
tests/controllers/test_genes.py .............                            [ 49%]
tests/controllers/test_genesets.py ................                      [ 57%]
tests/controllers/test_publications.py .......                           [ 61%]
tests/controllers/test_species.py ....                                   [ 63%]
tests/core/test_security.py ..........                                   [ 68%]
tests/services/io/test_read_file_contents.py ...............             [ 76%]
tests/services/test_gene.py ..............                               [ 83%]
tests/services/test_genset.py ....................                       [ 93%]
tests/services/test_publications.py .....                                [ 96%]
tests/services/test_species.py .......                                   [100%]

=============================== warnings summary ===============================
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/httpx/_client.py:680: 1 warning
tests/controllers/test_genes.py: 13 warnings
tests/controllers/test_genesets.py: 16 warnings
tests/controllers/test_publications.py: 7 warnings
tests/controllers/test_species.py: 4 warnings
  /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/httpx/_client.py:680: DeprecationWarning: The 'app' shortcut is now deprecated. Use the explicit style 'transport=WSGITransport(app=...)' instead.
    warnings.warn(message, DeprecationWarning)

tests/data/__init__.py:10
  /home/runner/work/geneweaver-api/geneweaver-api/tests/data/__init__.py:10: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    geneset_response_json = importlib.resources.read_text(

../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80
  /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/importlib/resources/_legacy.py:80: DeprecationWarning: open_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    with open_text(package, resource, encoding, errors) as fp:

tests/data/__init__.py:13
  /home/runner/work/geneweaver-api/geneweaver-api/tests/data/__init__.py:13: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    geneset_w_gene_id_type_json = importlib.resources.read_text(

tests/data/__init__.py:17
  /home/runner/work/geneweaver-api/geneweaver-api/tests/data/__init__.py:17: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    geneset_list_response_json = importlib.resources.read_text("tests.data", "geneset.json")

tests/data/__init__.py:19
  /home/runner/work/geneweaver-api/geneweaver-api/tests/data/__init__.py:19: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    gene_homologus_ids_json = importlib.resources.read_text(

tests/data/__init__.py:23
  /home/runner/work/geneweaver-api/geneweaver-api/tests/data/__init__.py:23: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    gene_id_mapping_json = importlib.resources.read_text("tests.data", "gene_maping.json")

tests/data/__init__.py:25
  /home/runner/work/geneweaver-api/geneweaver-api/tests/data/__init__.py:25: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    publications_json = importlib.resources.read_text("tests.data", "publications.json")

tests/data/__init__.py:27
  /home/runner/work/geneweaver-api/geneweaver-api/tests/data/__init__.py:27: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    jwt_test_keys_json = importlib.resources.read_text(

tests/data/__init__.py:31
  /home/runner/work/geneweaver-api/geneweaver-api/tests/data/__init__.py:31: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    species_json = importlib.resources.read_text("tests.data", "species.json")

tests/data/__init__.py:33
  /home/runner/work/geneweaver-api/geneweaver-api/tests/data/__init__.py:33: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    genes_json = importlib.resources.read_text("tests.data", "genes.json")

tests/controllers/test_genes.py: 10 warnings
  /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/httpx/_content.py:202: DeprecationWarning: Use 'content=<...>' to upload raw bytes/text content.
    warnings.warn(message, DeprecationWarning)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform linux, python 3.11.9-final-0 -----------
Name                                            Stmts   Miss  Cover
-------------------------------------------------------------------
src/geneweaver/api/__init__.py                      5      2    60%
src/geneweaver/api/controller/__init__.py           0      0   100%
src/geneweaver/api/controller/api.py               12      0   100%
src/geneweaver/api/controller/genes.py             38      0   100%
src/geneweaver/api/controller/genesets.py          87      3    97%
src/geneweaver/api/controller/message.py           19      0   100%
src/geneweaver/api/controller/publications.py      30      0   100%
src/geneweaver/api/controller/search.py             0      0   100%
src/geneweaver/api/controller/species.py           17      0   100%
src/geneweaver/api/core/__init__.py                 0      0   100%
src/geneweaver/api/core/config.py                   2      0   100%
src/geneweaver/api/core/config_class.py            27      1    96%
src/geneweaver/api/core/exceptions.py              10      1    90%
src/geneweaver/api/core/security.py               118     21    82%
src/geneweaver/api/dependencies.py                 56     30    46%
src/geneweaver/api/main.py                          1      0   100%
src/geneweaver/api/schemas/__init__.py              0      0   100%
src/geneweaver/api/schemas/apimodels.py            44      0   100%
src/geneweaver/api/schemas/auth.py                 19      0   100%
src/geneweaver/api/schemas/messages.py             18     18     0%
src/geneweaver/api/schemas/score.py                13     13     0%
src/geneweaver/api/services/__init__.py             0      0   100%
src/geneweaver/api/services/genes.py               45      0   100%
src/geneweaver/api/services/geneset.py             90      2    98%
src/geneweaver/api/services/io.py                   4      0   100%
src/geneweaver/api/services/parse/__init__.py       0      0   100%
src/geneweaver/api/services/publications.py        39      0   100%
src/geneweaver/api/services/pubmeds.py              0      0   100%
src/geneweaver/api/services/species.py             18      3    83%
-------------------------------------------------------------------
TOTAL                                             712     94    87%
Coverage HTML written to dir htmlcov

Required test coverage of 60% reached. Total coverage: 86.80%
================= 181 passed, 14 skipped, 69 warnings in 3.18s =================

Copy link
Collaborator

@bergsalex bergsalex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one minor change.

pyproject.toml Outdated
@@ -1,6 +1,6 @@
[tool.poetry]
name = "geneweaver-api"
version = "0.4.0"
version = "0.4.1.a01"
Copy link
Collaborator

@bergsalex bergsalex May 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be version 0.5.0a0.

@@ -21,7 +21,7 @@ python = "^3.9"
geneweaver-core = "^0.9.1"
fastapi = {extras = ["all"], version = "^0.99.1"}
uvicorn = {extras = ["standard"], version = "^0.24.0"}
geneweaver-db = "^0.3.0"
geneweaver-db = "^0.3.3"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

# check publication is not already in the DB
pub = db_publication.by_pubmed_id(cursor, pubmed_id)
if pub:
return {"error": True, "message": message.RECORD_EXISTS}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the publication exists, you can just return it. That would make the endpoint idempotent, which is desirable.

@francastell francastell had a problem deploying to jax-cluster-dev-10--dev May 2, 2024 14:49 — with GitHub Actions Failure
@francastell francastell temporarily deployed to jax-cluster-dev-10--dev May 2, 2024 14:52 — with GitHub Actions Inactive
@bergsalex bergsalex self-requested a review May 2, 2024 15:50
@francastell francastell merged commit d1dcc2c into main May 2, 2024
7 checks passed
@bergsalex bergsalex deleted the G3-226-add-publication-endpoint branch May 29, 2024 20:50
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 this pull request may close these issues.

2 participants