Skip to content

Commit

Permalink
SACGF/variantgrid_private#3680 ClinVar uploads - Also fix the ID port…
Browse files Browse the repository at this point in the history
…ion of BookShelf NBK
  • Loading branch information
TheMadBug committed Jul 19, 2024
1 parent e754ece commit 930c99d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions classification/models/clinvar_export_convertor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from dataclasses import dataclass
from functools import cached_property
from typing import Any, Mapping, TypedDict, Optional
Expand Down Expand Up @@ -280,6 +281,8 @@ class ClinVarExportConverter:
# classification_flag_types.classification_not_public - this has special handling to include a comment
}

BOOKSHELF_ID_RE = re.compile(".*(NBK[0-9]+)")

def __init__(self, clinvar_export_record: ClinVarExport):
"""
:param clinvar_export_record: the record to use as a basis to convert to ClinVar json (with validation)
Expand Down Expand Up @@ -322,10 +325,14 @@ def citations(self) -> list[ValidatedJson]:
citation_list = []
for citation in CitationFetchRequest.fetch_all_now(request_ids).all_citations:
if clinvar_db := ClinVarExportConverter.CITATION_SOURCE_TO_CLINVAR.get(citation.source):
# NEED to test for NBCI
citation_id = citation.id
if citation.source == CitationSource.NCBI_BOOKSHELF:
if m := ClinVarExportConverter.BOOKSHELF_ID_RE.match():
citation_id = m.group(1)

citation_json = {
"db": clinvar_db,
"id": citation.id
"id": citation_id
}
messages = JSON_MESSAGES_EMPTY

Expand Down

0 comments on commit 930c99d

Please sign in to comment.