Clinical-Genomics / preClinVar

A ClinVar API submission helper written in FastAPI
MIT License
1 stars 0 forks source link

Add optional parameters to file conversion endpoints #62

Closed northwestwitch closed 1 year ago

northwestwitch commented 1 year ago

This PR adds | fixes:

Fixes partly #51

Added top level submission descriptors as optional options in tsv_2_json and scv_2_json endpoints:

Added items:

These fields correspond to the following submission items:

"submissionName": {
      "type": "string",
      "description": "Optional. The name for this submission. If not provided, it will be the submission id."
    },
    "clinvarSubmissionReleaseStatus": {
      "type": "string",
      "description": "\"hold until published\" allows a temporary hold on submission data being presented publicly. If no value is provided, the default is public.",
      "enum": [
        "public",
        "hold until published"
      ]
    },
    "assertionCriteria": {
      "type": "object",
      "description": "\"Assertion criteria\" refers to documentation of the criteria that your organization uses to classify variants. It can be provided as a database identifier, like a PubMed ID, or a file that is submitted to ClinVar, but not both. Only one document may be provided for assertion criteria. These fields are equivalent to the \"Assertion method citation\" column in the spreadsheet. Note that only one single assertion criteria (a citation or an electronic document) may be provided for a submission. This assertion criteria will be applied to all interpretations in the submission.  For assertion criteria submitted as a database identifier, an assertion criteria name will be calculated based on the citation details. For assertion criteria submitted as a file, you may provide an assertion criteria name during file upload on your Organization page in Submission Portal.",
      "properties": {
        "db": {
          "type": "string",
          "enum": [
            "PubMed",
            "DOI",
            "pmc"
          ]
        },
        "id": {
          "type": "string",
          "pattern": "^[^;]+$",
          "errors": {
            "pattern": "The identifier value is considered an invalid citation. Please provide only one identifier as the citation for your assertion criteria."
          }
        },
        "url": {
          "type": "string",
          "description": " The URL for a file that you have already submitted to ClinVar as assertion criteria. If you need to find this URL or if you need to submit new assertion criteria, please go to the \"View/add assertion criteria files\" tab on your Organization page in Submission Portal.",
          "pattern": "^https://[qd]?submit.ncbi.nlm.nih.gov/(api/2.0/files|ft/byid)/.*",
          "errors": {
            "pattern": "The URL for assertion criteria must be the URL provided by ClinVar. If you need to find this URL or if you need to submit new assertion criteria, Please go to the \"View/add assertion criteria files\" tab on your Organization page in Submission Portal."
          }
        }
      },
      "additionalProperties": false,
      "oneOf": [
        {
          "required": [
            "url"
          ]
        },
        {
          "required": [
            "db",
            "id"
          ]
        }
      ]
    },

How to prepare for test:

How to test:

-

Expected outcome:

Review:

This version is a:

codecov-commenter commented 1 year ago

Codecov Report

Base: 95.65% // Head: 96.00% // Increases project coverage by +0.34% :tada:

Coverage data is based on head (718a0d4) compared to base (f702aaf). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #62 +/- ## ========================================== + Coverage 95.65% 96.00% +0.34% ========================================== Files 9 9 Lines 299 325 +26 ========================================== + Hits 286 312 +26 Misses 13 13 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `96.00% <100.00%> (+0.34%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Clinical-Genomics#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/Clinical-Genomics/preClinVar/pull/62?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Clinical-Genomics) | Coverage Δ | | |---|---|---| | [preClinVar/build.py](https://codecov.io/gh/Clinical-Genomics/preClinVar/pull/62/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Clinical-Genomics#diff-cHJlQ2xpblZhci9idWlsZC5weQ==) | `100.00% <100.00%> (ø)` | | | [preClinVar/main.py](https://codecov.io/gh/Clinical-Genomics/preClinVar/pull/62/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Clinical-Genomics#diff-cHJlQ2xpblZhci9tYWluLnB5) | `91.13% <100.00%> (+0.23%)` | :arrow_up: | | [tests/test\_main.py](https://codecov.io/gh/Clinical-Genomics/preClinVar/pull/62/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Clinical-Genomics#diff-dGVzdHMvdGVzdF9tYWluLnB5) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Clinical-Genomics). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Clinical-Genomics)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

northwestwitch commented 1 year ago

Testing the endpoint by passing the following parameters:

image

The response is successful: 🆗

image

Validation of the created json file, using the /dry-run e endpoint 🆗

image