clinvar_api package

Subpackages

Submodules

clinvar_api.client module

REST API client code for communicating with server endpoints.

class clinvar_api.client.AsyncClient(config: Config)[source]

Bases: object

NCBI ClinVar REST API client (async).

async retrieve_status(submission_id: str) RetrieveStatusResult[source]

Retrieve submission status from API.

Parameters:

submission_id – The identifier of the submission as returned earlier from API.

Returns:

The information about the created submission.

Raises:

exceptions.QueryFailed – on problems with the communication to the server.

async submit_data(payload: SubmissionContainer) Created[source]

Submit new data to ClinVar API.

Parameters:

payload – The submission data.

Returns:

The information about the created submission.

Raises:

exceptions.SubmissionFailed – on problems with the submission.

class clinvar_api.client.Client(config: Config)[source]

Bases: object

NCBI ClinVar REST API client (sync).

retrieve_status(submission_id: str) RetrieveStatusResult[source]

Retrieve submission status from API.

Parameters:

submission_id – The identifier of the submission as returned earlier from API.

Returns:

The information about the created submission.

Raises:

exceptions.QueryFailed – on problems with the communication to the server.

submit_data(payload: SubmissionContainer) Created[source]

Submit new data to ClinVar API.

Parameters:

payload – The submission data.

Returns:

The information about the created submission.

Raises:

exceptions.SubmissionFailed – on problems with the submission.

class clinvar_api.client.Config(*, auth_token: SecretStr, use_testing: bool = False, use_dryrun: bool = False, presubmission_validation: bool = True, verify_ssl: bool = True)[source]

Bases: BaseModel

Configuration for the Client class.

auth_token: SecretStr

Token to use for authentication.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'auth_token': FieldInfo(annotation=SecretStr, required=True), 'presubmission_validation': FieldInfo(annotation=bool, required=False, default=True), 'use_dryrun': FieldInfo(annotation=bool, required=False, default=False), 'use_testing': FieldInfo(annotation=bool, required=False, default=False), 'verify_ssl': FieldInfo(annotation=bool, required=False, default=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

presubmission_validation: bool

Whether to validate submission payload before posting.

use_dryrun: bool

Whether to use dry running.

use_testing: bool

Whether to use the test endpoint.

verify_ssl: bool

Whether or not to verify SSL on submission.

clinvar_api.client.ENDPOINT_URL_PROD = 'https://submit.ncbi.nlm.nih.gov/api/v1/submissions/'

URL of the server endpoint (non-test/production).

clinvar_api.client.ENDPOINT_URL_TEST = 'https://submit.ncbi.nlm.nih.gov/apitest/v1/submissions/'

URL of the test endpoint.

class clinvar_api.client.RetrieveStatusResult(*, status: SubmissionStatus, summaries: Dict[str, SummaryResponse])[source]

Bases: BaseModel

Result type for retrieve_status function.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'status': FieldInfo(annotation=SubmissionStatus, required=True), 'summaries': FieldInfo(annotation=Dict[str, SummaryResponse], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

status: SubmissionStatus

The submission status.

summaries: Dict[str, SummaryResponse]

A dict mapping file URLs to the parsed Sum.

clinvar_api.client.SUFFIX_DRYRUN = '?dry-run=true'

URL suffix for enabling dry-run.

async clinvar_api.client.async_retrieve_status(submission_id: str, config: Config) RetrieveStatusResult[source]

Retrieve submission status from API.

Parameters:
  • submission_id – The identifier of the submission as returned earlier from API.

  • config – The connfiguration to use.

Returns:

The information about the created submission.

Raises:

exceptions.QueryFailed – on problems with the communication to the server.

async clinvar_api.client.async_submit_data(submission_container: SubmissionContainer, config: Config) Created[source]

Submit new data to ClinVar API via async API (async).

Parameters:
  • submission_container – The submission data.

  • config – The connfiguration to use.

Returns:

The information about the created submission.

Raises:

exceptions.SubmissionFailed – on problems with the submission.

clinvar_api.client.retrieve_status(submission_id: str, config: Config) RetrieveStatusResult[source]

Retrieve submission status from API.

Parameters:
  • submission_id – The identifier of the submission as returned earlier from API.

  • config – The connfiguration to use.

Returns:

The information about the created submission.

Raises:

exceptions.QueryFailed – on problems with the communication to the server.

clinvar_api.client.submit_data(submission_container: SubmissionContainer, config: Config) Created[source]

Submit new data to ClinVar API (sync).

Parameters:
  • submission_container – The submission data.

  • config – The connfiguration to use.

Returns:

The information about the created submission.

Raises:

exceptions.SubmissionFailed – on problems with the submission.

clinvar_api.common module

clinvar_api.common.clean_for_json(value: bool | int | float | List[Any] | None | Dict[str, Any]) bool | int | float | List[Any] | None | Dict[str, Any][source]

Clean the given value for JSON submission.

clinvar_api.constants module

clinvar_api.exceptions module

Module with the exception classes.

exception clinvar_api.exceptions.ClinvarApiException[source]

Bases: Exception

Base exception for clinvar_api.

exception clinvar_api.exceptions.QueryFailed[source]

Bases: ClinvarApiException

Raised when the status query failed.

exception clinvar_api.exceptions.SubmissionFailed[source]

Bases: ClinvarApiException

Raised when there was a problem with submitting to ClinVar.

Module contents