Skip to content

Commit

Permalink
feat: Add page about version of services we use (#603) (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon authored Mar 28, 2024
1 parent e84fffa commit aad9eaa
Show file tree
Hide file tree
Showing 8 changed files with 382 additions and 5 deletions.
192 changes: 192 additions & 0 deletions backend/app/api/internal/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import datetime
import subprocess

from fastapi import APIRouter, Response
from fastapi.responses import JSONResponse
from pydantic import BaseModel

from app.api.internal.endpoints import proxy, remote
from app.core.config import settings
Expand All @@ -12,6 +14,184 @@
api_router.include_router(remote.router, prefix="/remote", tags=["remote"])


class DataVersions(BaseModel):
"""Container with data versions."""

#: Annonars version.
annonars: str
#: Viguno version.
viguno: str
#: Mehari version.
mehari: str
#: Cada-prio version.
cada_prio: str
#: Dotty version.
dotty: str
#: Variant validator version.
variant_validator: str
#: InterVar version.
intervar: str
#: AutoCNV version.
autocnv: str
#: PubTator3 version.
pubtator3: str
#: Beacon Network version.
beacon_network: str
#: String to use for AlphaMissense version.
alphamissense: str
#: String to use for ClinGen gene curation version.
clingen_gene: str
#: String to use for ClinGen variant curation version.
clingen_variant: str
#: String to use for GRCh37 ENSEMBL version.
ensembl_37: str
#: String to use for GRCh38 ENSEMBL version.
ensembl_38: str
#: String to use for ENSEMBL version.
ensembl: str
#: Version of dbNSFP.
dbnsfp: str
#: Version of dbscSNV.
dbscsnv: str
#: Version of CADD.
cadd: str
#: Version of gnomAD for constraints.
gnomad_constraints: str
#: Version of gnomAD mtDNA.
gnomad_mtdna: str
#: Version of gnomAD v2.
gnomad_v2: str
#: Version of gnomAD v3.
gnomad_v3: str
#: Version of gnomAD v4.
gnomad_v4: str
#: Version of gnomAD SV.
gnomad_sv: str
#: Version of gnomAD CNV v4.
gnomad_cnv4: str
#: Version of gnomAD SV v4.
gnomad_sv4: str
#: Version of dbVar.
dbvar: str
#: Version of DGV.
dgv: str
#: Version of DGV Gold Standard.
dgv_gs: str
#: ExAC CNVs.
exac_cnv: str
#: Thousand Genomes SVs.
g1k_svs: str
#: HelixMtDb
helixmtdb: str
#: UCSC conservation (GRCh37).
ucsc_cons_37: str
#: UCSC conservation (GRCh38).
ucsc_cons_38: str
#: UCSC repeat masker (GRCh37).
ucsc_rmsk_37: str
#: UCSC repeat masker (GRCh38).
ucsc_rmsk_38: str
#: UCSC genomicSuperDups (GRCh37).
ucsc_genomic_super_dups_37: str
#: UCSC genomicSuperDups (GRCh38).
ucsc_genomic_super_dups_38: str
#: UCSC genome browser altSeqLiftOverPsl (GRCh37).
ucsc_alt_seq_liftover_37: str
#: UCSC genome browser altSeqLiftOverPsl (GRCh38).
ucsc_alt_seq_liftover_38: str
#: UCSC genome browser fixSeqLiftOverPsl (GRCh37).
ucsc_fix_seq_liftover_37: str
#: UCSC genome browser fixSeqLiftOverPsl (GRCh38).
ucsc_fix_seq_liftover_38: str
#: RefSeq version (GRCh37).
refseq_37: str
#: RefSeq version (GRCh38).
refseq_38: str
#: dbSNP version.
dbsnp: str
#: ACMG secondary findings version.
acmg_sf: str
#: HPO
hpo: str
#: Orphadata
orphadata: str
#: Pathogenic MMS
patho_mms: str
#: Mehari transcript data.
mehari_tx: str
#: ClinVar release.
clinvar_release: str
#: ClinVar version.
clinvar_version: str
#: RefSeq functional elements for GRCh37.
refseq_fe_37: str
#: RefSeq functional elements for GRCh38.
refseq_fe_38: str


#: The current date.
TODAY = datetime.date.strftime(datetime.date.today(), "%Y%m%d")

#: The data versions to use.
DATA_VERSIONS = DataVersions(
annonars="0.2.1",
viguno="0.36.1",
mehari="0.25.4",
cada_prio="0.6.1",
dotty="0.4.1",
variant_validator="2.2.1",
intervar="2021-08",
autocnv="latest",
pubtator3="latest",
beacon_network="latest",
alphamissense="1",
clingen_gene=TODAY,
clingen_variant=TODAY,
ensembl_37="87",
ensembl_38="109",
ensembl="111",
dbnsfp="4.5",
dbscsnv="1.1",
cadd="1.6",
gnomad_constraints="4.0",
gnomad_mtdna="3.1",
gnomad_v2="2.1.1",
gnomad_v3="3.1.2",
gnomad_v4="4.0",
gnomad_sv="2.1.1",
gnomad_cnv4="4.0",
gnomad_sv4="4.0",
dbvar="20231030",
dgv="20200225",
dgv_gs="20160515",
exac_cnv="0.3.1",
g1k_svs="phase3v2",
helixmtdb="20200327",
ucsc_cons_37="20161007",
ucsc_cons_38="20190906",
ucsc_rmsk_37="20200322",
ucsc_rmsk_38="20221018",
ucsc_genomic_super_dups_37="20111025",
ucsc_genomic_super_dups_38="20141019",
ucsc_alt_seq_liftover_37="20200322",
ucsc_alt_seq_liftover_38="20221103",
ucsc_fix_seq_liftover_37="20200524",
ucsc_fix_seq_liftover_38="20221103",
refseq_37="105",
refseq_38="GCF_000001405.40+RS_2023_03",
dbsnp="b151",
acmg_sf="3.1",
hpo="20240116",
orphadata=TODAY,
patho_mms="20220730",
mehari_tx="0.4.4",
clinvar_release="2023_09",
clinvar_version="v2.0",
refseq_fe_37="105.20201022",
refseq_fe_38="110",
)


@api_router.get("/version")
@api_router.post("/version")
async def version():
Expand Down Expand Up @@ -42,3 +222,15 @@ async def frontend_settings():
"matomo_site_id": settings.MATOMO_SITE_ID,
}
return JSONResponse(content=frontend_settings)


@api_router.get("/data-versions")
@api_router.post("/data-versions")
async def data_versions():
"""
Return versions of data and services used in the application.
:return: A JSON response containing the versions of various data and services.
:rtype: dict
"""
return JSONResponse(content=DATA_VERSIONS.dict())
7 changes: 7 additions & 0 deletions frontend/src/api/misc/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ export class MiscClient {
})
return await response.text()
}

async fetchDataVersions(): Promise<any> {
const response = await fetch(`${this.apiBaseUrl}data-versions`, {
method: 'GET'
})
return await response.json()
}
}
3 changes: 3 additions & 0 deletions frontend/src/components/PageHeader/PageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ function toggleTheme() {
<v-list-item id="terms" to="/info#terms-of-use">
<v-list-item-title> Terms of Use </v-list-item-title>
</v-list-item>
<v-list-item id="data-versions" to="/info#data-versions">
<v-list-item-title> Data Versions </v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-container>
Expand Down
34 changes: 34 additions & 0 deletions frontend/src/components/StaticViews/DataVersionsView.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { setupMountedComponents } from '@bihealth/reev-frontend-lib/lib/testUtils'
import { describe, it, vi } from 'vitest'

import { StoreState } from '@/stores'

import DataVersionsView from './DataVersionsView.vue'

describe.concurrent('DataVersionsView', async () => {
it.skip('renders the main content', async () => {
// arrange:
const mockInitialize = vi.fn().mockImplementation(async () => {})
const { wrapper } = await setupMountedComponents(
{ component: DataVersionsView },
{
initialStoreState: {
misc: {
storeState: StoreState.Active,
appVersion: 'v0.0.0',
dataVersions: {
alphamissense: '2021-01-01',
clingen_gene: '2021-01-01'
},
initialize: mockInitialize
}
}
}
)

// act: nothing, only test rendering

// assert:
console.log(wrapper.html())
})
})
62 changes: 62 additions & 0 deletions frontend/src/components/StaticViews/DataVersionsView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useMiscStore } from '@/stores/misc'
const miscStore = useMiscStore()
/** Data version to display. */
const transformedDataVersions = ref<{ name: string; version: string }[]>([])
/** Define table headers */
const headers = ref([
{ text: 'Resource', value: 'name' },
{ text: 'Version', value: 'version' }
])
const initializeDataVersions = async () => {
await miscStore.initialize()
const transformDataVersions = () => {
if (miscStore.dataVersions) {
return Object.entries(miscStore.dataVersions).map(([name, version]) => ({
name,
version: version ? String(version) : ''
}))
} else {
return []
}
}
transformedDataVersions.value = transformDataVersions()
}
onMounted(initializeDataVersions)
</script>

<template>
<v-card>
<v-card-title>Data Sources</v-card-title>
<v-card-subtitle>
The following data sources and service versions are used in REEV application.
</v-card-subtitle>
<v-card-text>
<div v-if="transformedDataVersions && transformedDataVersions.length > 0"></div>
<v-table>
<thead>
<tr>
<!-- Table Headers -->
<th v-for="header in headers" :key="header.value">
{{ header.text }}
</th>
</tr>
</thead>
<tbody>
<!-- Table Rows -->
<tr v-for="(item, index) in transformedDataVersions" :key="index">
<td>{{ item.name }}</td>
<td>{{ item.version }}</td>
</tr>
</tbody>
</v-table>
</v-card-text>
</v-card>
</template>
12 changes: 10 additions & 2 deletions frontend/src/stores/misc/store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,23 @@ describe('miscInfo Store', () => {

it('should load data', async () => {
// arrange:
fetchMocker.mockResponseOnce('v0.0.0')
fetchMocker.mockResponse((req) => {
if (req.url.includes('version') && !req.url.includes('data')) {
return Promise.resolve(JSON.stringify('v0.0.0'))
} else if (req.url.includes('data')) {
return Promise.resolve(JSON.stringify({ dataVersions: { data: 'versions' } }))
}
return Promise.resolve(JSON.stringify({ status: 400 }))
})
const store = useMiscStore()

// act:
await store.initialize()

// assert:
expect(store.storeState).toBe(StoreState.Active)
expect(store.appVersion).toBe('v0.0.0')
expect(store.appVersion).toBe('"v0.0.0"')
expect(store.dataVersions).toStrictEqual({ dataVersions: { data: 'versions' } })
})

it('should handle error', async () => {
Expand Down
Loading

0 comments on commit aad9eaa

Please sign in to comment.