CIViCpy is an analysis toolkit and SDK for extracting and analyzing knowledge from the CIViC knowledgebase.

If you find CIViCpy useful for your work, please cite our manuscript!


The use of Python 3 is mandatory for CIViCpy. Python 2 has been sunset as of January 1, 2020.

Using CIViCpy:

>>> from civicpy import civic
>>> my_variant_ids = [12, 306, 79]
>>> my_variants = civic.get_variants_by_ids(my_variant_ids)
>>> my_variants
[<CIViC variant 12>, <CIViC variant 79>, <CIViC variant 306>]

>>> [(, for v in my_variants]
[('BRAF', 'V600E'), ('KRAS', 'G12D'), ('ERBB2', 'AMPLIFICATION')]

>>> braf_id = my_variants[0].gene_id # or my_variants[0]
>>> braf_variants = civic.get_gene_by_id(braf_id).variants
>>> len(braf_variants)

>>> set(my_variants) & set(braf_variants)
{<CIViC variant 12>}

CIViCpy lets you pull data from CIViC using the civic module and interact with records as dynamic objects. With the aid of caching, it is easy to explore relationships between CIViC records (e.g. assertions, genes, variants) without worrying about querying CIViC more than once for the same data.


  • Record Caching

  • Hashable and Comparable Records

  • Simplified API Requests

  • Sensible Pre-caching

  • Arbitrary-depth Record Nesting