Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applications/sckanner/backend/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
2 changes: 1 addition & 1 deletion applications/sckanner/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sckan-explorer",
"private": true,
"version": "3.1.1",
"version": "3.2.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
50 changes: 45 additions & 5 deletions applications/sckanner/frontend/src/components/SummaryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>('');

// @ts-expect-error Explanation: Handling Event properly
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
Expand Down Expand Up @@ -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',
Expand All @@ -63,7 +80,7 @@ const SummaryPage = () => {
}
}

for (const file in FILES) {
for (const file of statFiles) {
const request = new XMLHttpRequest();
request.open(
'GET',
Expand Down Expand Up @@ -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 (
<Detail
keyName={item.label}
value={item.count}
labels={item.label}
index={Math.random()}
change={Number(item.change)}
/>
);
});
Expand All @@ -219,6 +256,7 @@ const SummaryPage = () => {
value={total}
labels="Total"
index={Math.random()}
change={totalChange}
/>,
);
return results;
Expand Down Expand Up @@ -278,9 +316,11 @@ const SummaryPage = () => {
>
Database summary
</Typography>
<Typography variant="body1" color={gray500}>
Last updated on Apr 24, 2025
</Typography>
{lastUpdated && (
<Typography variant="body1" color={gray500}>
Last updated on {lastUpdated}
</Typography>
)}
</Stack>
<Box
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ const SummaryDetails = ({
const getForwardConnections = () => {
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);
}
});
Expand All @@ -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,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ 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) => (
<Stack
key={keyName}
direction="row"
Expand Down Expand Up @@ -54,17 +61,18 @@ export const Detail = ({ keyName, value, labels, index }: DetailProps) => (
color={gray600}
>
{value}
{change != null && change !== 0 && (
<Typography
component="span"
variant="h5"
fontWeight={400}
color={gray500}
sx={{ marginLeft: '.25rem' }}
>
({change > 0 ? `+${change}` : change})
</Typography>
)}
</Typography>
{/* {sectionData[`${keyName}_changes`] && (
<Typography
variant="body1"
width="23rem"
textAlign="right"
color={gray500}
>
+{sectionData[`${keyName}_changes`]} change (since last stats)
</Typography>
)} */}
</Stack>
</Stack>
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { COMPOSER_VERSION, NEURONDM_VERSION } from '../settings';
import {
COMPOSER_VERSION,
NEURONDM_VERSION,
SCKANNER_VERSION,
} from '../settings';

export const sckanInfoText = {
summary: {
Expand Down Expand Up @@ -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,
],
Expand Down
2 changes: 2 additions & 0 deletions applications/sckanner/frontend/src/services/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ interface KnowledgeStatementAPI {
sex: Sex;
statement_preview: string;
statement_alerts: StatementAlert[];
curie_id: string;
}

export function mapApiResponseToKnowledgeStatements(
Expand Down Expand Up @@ -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 || '',
}));
}

Expand Down
50 changes: 46 additions & 4 deletions applications/sckanner/frontend/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@ 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 = {
POPULATION: 'POPULATION',
PHENOTYPE: 'PHENOTYPE',
SPECIES: 'SPECIES',
CATEGORY: 'CATEGORY',
INFO: 'INFO',
};

export const DATABASE_FILES = {
[FILES.POPULATION]: 'stats-model-population-count.json',
[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';
Expand Down Expand Up @@ -76,6 +78,46 @@ 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';

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 => {
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;
Loading