From a9278f8555aaa37136286bb89b75c8b5924923f0 Mon Sep 17 00:00:00 2001 From: Dario Del Piano Date: Tue, 31 Mar 2026 22:27:46 +0200 Subject: [PATCH 1/4] Fixed database summary, version extracted from json, curie id to replace id in details, counter improvements --- applications/sckanner/frontend/package.json | 2 +- .../frontend/src/components/SummaryPage.tsx | 50 +++++++++++++++++-- .../components/connections/SummaryDetails.tsx | 8 +-- .../src/components/summaryPage/Detail.tsx | 26 +++++----- .../src/data/database_summary_info.ts | 8 ++- .../sckanner/frontend/src/services/mappers.ts | 2 + .../sckanner/frontend/src/settings.ts | 29 +++++++++-- 7 files changed, 99 insertions(+), 26 deletions(-) diff --git a/applications/sckanner/frontend/package.json b/applications/sckanner/frontend/package.json index b26fe613..e37b719d 100644 --- a/applications/sckanner/frontend/package.json +++ b/applications/sckanner/frontend/package.json @@ -1,7 +1,7 @@ { "name": "sckan-explorer", "private": true, - "version": "3.1.1", + "version": "3.2.0", "type": "module", "scripts": { "dev": "vite", diff --git a/applications/sckanner/frontend/src/components/SummaryPage.tsx b/applications/sckanner/frontend/src/components/SummaryPage.tsx index 675c4a8e..15f4d490 100644 --- a/applications/sckanner/frontend/src/components/SummaryPage.tsx +++ b/applications/sckanner/frontend/src/components/SummaryPage.tsx @@ -17,10 +17,20 @@ import descriptionsData from '../data/descriptions.json'; const { primaryPurple600, gray500, white } = vars; +const formatDate = (dateStr: string): string => { + const date = new Date(dateStr + 'T00:00:00'); + return date.toLocaleDateString('en-US', { + year: 'numeric', + month: 'short', + day: 'numeric', + }); +}; + const SummaryPage = () => { const [data, setData] = useState<{ [x: string]: null }>({}); const [loaded, setLoaded] = useState(false); const [value, setValue] = useState(0); + const [lastUpdated, setLastUpdated] = useState(''); // @ts-expect-error Explanation: Handling Event properly const handleChange = (event: React.SyntheticEvent, newValue: number) => { @@ -50,7 +60,14 @@ const SummaryPage = () => { [FILES.CATEGORY]: null, }; - for (const file in FILES) { + const statFiles = [ + FILES.POPULATION, + FILES.PHENOTYPE, + FILES.SPECIES, + FILES.CATEGORY, + ]; + + for (const file of statFiles) { const request = new XMLHttpRequest(); request.open( 'GET', @@ -63,7 +80,7 @@ const SummaryPage = () => { } } - for (const file in FILES) { + for (const file of statFiles) { const request = new XMLHttpRequest(); request.open( 'GET', @@ -196,20 +213,40 @@ const SummaryPage = () => { } }); + // Fetch version info for "last updated" date + const versionRequest = new XMLHttpRequest(); + versionRequest.open( + 'GET', + SCKAN_DATABASE_SUMMARY_URL_LATEST + DATABASE_FILES[FILES.INFO], + false, + ); + versionRequest.send(null); + if (versionRequest.status === 200) { + const versionData = JSON.parse(versionRequest.responseText); + const dateValue = + versionData?.results?.bindings?.[0]?.sckan_version?.value; + if (dateValue) { + setLastUpdated(formatDate(dateValue)); + } + } + setLoaded(true); setData(results); }, []); const getDataPerSection = (section: any) => { let total = 0; + let totalChange = 0; const results = section.map((item: any) => { total += Number(item.count); + totalChange += Number(item.change || 0); return ( ); }); @@ -219,6 +256,7 @@ const SummaryPage = () => { value={total} labels="Total" index={Math.random()} + change={totalChange} />, ); return results; @@ -278,9 +316,11 @@ const SummaryPage = () => { > Database summary - - Last updated on Apr 24, 2025 - + {lastUpdated && ( + + Last updated on {lastUpdated} + + )} { const forwardConnections: string[] = []; connectionDetails?.forwardConnections.forEach((conn) => { - if (conn?.reference_uri !== undefined) { + if (conn?.curie_id !== undefined) { + forwardConnections.push(conn.curie_id); + } else if (conn?.reference_uri !== undefined) { forwardConnections.push(conn.reference_uri); } }); @@ -84,8 +86,8 @@ const SummaryDetails = ({ // Details shown in the dropdown - from composer const detailsObject = [ { - label: 'Connection Id', - value: connectionDetails?.id || '-', + label: 'Curie ID', + value: connectionDetails?.curie_id || '-', icon: undefined, }, { diff --git a/applications/sckanner/frontend/src/components/summaryPage/Detail.tsx b/applications/sckanner/frontend/src/components/summaryPage/Detail.tsx index 5f82d9d9..67e9b41c 100644 --- a/applications/sckanner/frontend/src/components/summaryPage/Detail.tsx +++ b/applications/sckanner/frontend/src/components/summaryPage/Detail.tsx @@ -2,15 +2,16 @@ import { Stack, Tooltip, Typography } from '@mui/material'; import { vars } from '../../theme/variables.ts'; import { HelpCircle } from '../icons/index.tsx'; import IconButton from '@mui/material/IconButton'; -const { gray700, gray600 } = vars; +const { gray700, gray600, gray500 } = vars; interface DetailProps { keyName: string; value: string | number; labels: string; index: number; + change?: number; } -export const Detail = ({ keyName, value, labels, index }: DetailProps) => ( +export const Detail = ({ keyName, value, labels, index, change }: DetailProps) => ( ( color={gray600} > {value} + {change != null && change !== 0 && ( + + ({change > 0 ? `+${change}` : change}) + + )} - {/* {sectionData[`${keyName}_changes`] && ( - - +{sectionData[`${keyName}_changes`]} change (since last stats) - - )} */} ); diff --git a/applications/sckanner/frontend/src/data/database_summary_info.ts b/applications/sckanner/frontend/src/data/database_summary_info.ts index 449d47e7..ec2714e9 100644 --- a/applications/sckanner/frontend/src/data/database_summary_info.ts +++ b/applications/sckanner/frontend/src/data/database_summary_info.ts @@ -1,4 +1,8 @@ -import { COMPOSER_VERSION, NEURONDM_VERSION } from '../settings'; +import { + COMPOSER_VERSION, + NEURONDM_VERSION, + SCKANNER_VERSION, +} from '../settings'; export const sckanInfoText = { summary: { @@ -40,7 +44,7 @@ export const sckanInfoText = { versions: { title: 'Versions', bulletPoints: [ - 'SCKANNER Version: 1.0.0-beta', + 'SCKANNER Version: ' + SCKANNER_VERSION, 'Composer Version: ' + COMPOSER_VERSION, 'SCKAN Version: ' + NEURONDM_VERSION, ], diff --git a/applications/sckanner/frontend/src/services/mappers.ts b/applications/sckanner/frontend/src/services/mappers.ts index 7d7392dc..b463a779 100644 --- a/applications/sckanner/frontend/src/services/mappers.ts +++ b/applications/sckanner/frontend/src/services/mappers.ts @@ -60,6 +60,7 @@ interface KnowledgeStatementAPI { sex: Sex; statement_preview: string; statement_alerts: StatementAlert[]; + curie_id: string; } export function mapApiResponseToKnowledgeStatements( @@ -112,6 +113,7 @@ export function mapApiResponseToKnowledgeStatements( sex: ks.sex || {}, statement_preview: ks.statement_preview || '', statement_alerts: ks.statement_alerts || [], + curie_id: ks.curie_id || '', })); } diff --git a/applications/sckanner/frontend/src/settings.ts b/applications/sckanner/frontend/src/settings.ts index 8c46d359..3e001724 100644 --- a/applications/sckanner/frontend/src/settings.ts +++ b/applications/sckanner/frontend/src/settings.ts @@ -3,10 +3,10 @@ export const SCKAN_ORDER_JSON_URL = export const SCKAN_MAJOR_NERVES_JSON_URL = 'https://raw.githubusercontent.com/smtifahim/SCKAN-Apps/refs/heads/master/sckan-explorer/json/major-nerves.json'; -export const SCKAN_DATABASE_SUMMARY_URL_LATEST = +export const SCKAN_DATABASE_SUMMARY_URL_PREVIOUS = 'https://raw.githubusercontent.com/smtifahim/SCKAN-Apps/refs/heads/master/sckan-explorer/json/sckanner-data/stats/sckan-version-2024-09-21/'; -export const SCKAN_DATABASE_SUMMARY_URL_PREVIOUS = +export const SCKAN_DATABASE_SUMMARY_URL_LATEST = 'https://raw.githubusercontent.com/smtifahim/SCKAN-Apps/refs/heads/master/sckan-explorer/json/sckanner-data/stats/prod/'; export const FILES = { @@ -14,6 +14,7 @@ export const FILES = { PHENOTYPE: 'PHENOTYPE', SPECIES: 'SPECIES', CATEGORY: 'CATEGORY', + INFO: 'INFO', }; export const DATABASE_FILES = { @@ -21,6 +22,7 @@ export const DATABASE_FILES = { [FILES.PHENOTYPE]: 'stats-phenotype-count.json', [FILES.SPECIES]: 'stats-phenotype-value-count.json', [FILES.CATEGORY]: 'stats-population-category-count.json', + [FILES.INFO]: 'sckan-version-info.json', }; export const OTHER_X_AXIS_ID = 'OTHER_X'; @@ -77,5 +79,26 @@ export const STRINGS_NUMBERS = [ // Get version from Vite environment variable (set at build time) export const SCKANNER_VERSION = import.meta.env.VITE_APP_VERSION || '3.1.1'; export const COMPOSER_VERSION = '6.0.0'; -export const NEURONDM_VERSION = '2025-10-27'; + +// Fetch NEURONDM version from remote sckan-version-info.json +const fetchNeurondmVersion = (): string => { + try { + const request = new XMLHttpRequest(); + request.open( + 'GET', + SCKAN_DATABASE_SUMMARY_URL_LATEST + DATABASE_FILES[FILES.INFO], + false, + ); + request.send(null); + if (request.status === 200) { + const data = JSON.parse(request.responseText); + return data?.results?.bindings?.[0]?.sckan_version?.value || ''; + } + } catch { + // fallback on error + } + return ''; +}; +export const NEURONDM_VERSION = fetchNeurondmVersion(); + export const KNOWLEDGE_STATEMENTS_BATCH_SIZE = 15; From f7af889174e6905613def1ee5882d55b49a4b222 Mon Sep 17 00:00:00 2001 From: Dario Del Piano Date: Tue, 31 Mar 2026 22:28:23 +0200 Subject: [PATCH 2/4] bumping BE version up --- applications/sckanner/backend/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/sckanner/backend/setup.py b/applications/sckanner/backend/setup.py index df996639..dacc26c7 100644 --- a/applications/sckanner/backend/setup.py +++ b/applications/sckanner/backend/setup.py @@ -5,7 +5,7 @@ from setuptools import find_packages, setup NAME = "sckanner" -VERSION = "3.1.1" +VERSION = "3.2.0" # To install the library, run the following # From 425cfe9e2a2bb64cb4040397d866214e24da3c50 Mon Sep 17 00:00:00 2001 From: Dario Del Piano Date: Wed, 1 Apr 2026 15:01:36 +0200 Subject: [PATCH 3/4] fetching composer version dynamically --- .../sckanner/frontend/src/settings.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/applications/sckanner/frontend/src/settings.ts b/applications/sckanner/frontend/src/settings.ts index 3e001724..ba2ee1a4 100644 --- a/applications/sckanner/frontend/src/settings.ts +++ b/applications/sckanner/frontend/src/settings.ts @@ -78,7 +78,26 @@ export const STRINGS_NUMBERS = [ // Get version from Vite environment variable (set at build time) export const SCKANNER_VERSION = import.meta.env.VITE_APP_VERSION || '3.1.1'; -export const COMPOSER_VERSION = '6.0.0'; + +const COMPOSER_PACKAGE_JSON_URL = + 'https://raw.githubusercontent.com/MetaCell/sckan-composer/refs/heads/main/applications/composer/frontend/package.json'; + +// Fetch Composer version from its package.json on GitHub +const fetchComposerVersion = (): string => { + try { + const request = new XMLHttpRequest(); + request.open('GET', COMPOSER_PACKAGE_JSON_URL, false); + request.send(null); + if (request.status === 200) { + const data = JSON.parse(request.responseText); + return data?.version || ''; + } + } catch { + // fallback on error + } + return ''; +}; +export const COMPOSER_VERSION = fetchComposerVersion(); // Fetch NEURONDM version from remote sckan-version-info.json const fetchNeurondmVersion = (): string => { From 4f3fcd58bf8d08bce3ecc5948e82eab5cf28cef6 Mon Sep 17 00:00:00 2001 From: Dario Del Piano Date: Wed, 1 Apr 2026 16:50:01 +0200 Subject: [PATCH 4/4] fixing linter --- .../frontend/src/components/summaryPage/Detail.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/applications/sckanner/frontend/src/components/summaryPage/Detail.tsx b/applications/sckanner/frontend/src/components/summaryPage/Detail.tsx index 67e9b41c..c3ad6064 100644 --- a/applications/sckanner/frontend/src/components/summaryPage/Detail.tsx +++ b/applications/sckanner/frontend/src/components/summaryPage/Detail.tsx @@ -11,7 +11,13 @@ interface DetailProps { index: number; change?: number; } -export const Detail = ({ keyName, value, labels, index, change }: DetailProps) => ( +export const Detail = ({ + keyName, + value, + labels, + index, + change, +}: DetailProps) => (