Skip to content

Commit f89ed88

Browse files
authored
Merge pull request #156 from MetaCell/release/3.2.0
Release/3.2.0
2 parents 0136931 + 4f3fcd5 commit f89ed88

8 files changed

Lines changed: 126 additions & 28 deletions

File tree

applications/sckanner/backend/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from setuptools import find_packages, setup
66

77
NAME = "sckanner"
8-
VERSION = "3.1.1"
8+
VERSION = "3.2.0"
99

1010
# To install the library, run the following
1111
#

applications/sckanner/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sckan-explorer",
33
"private": true,
4-
"version": "3.1.1",
4+
"version": "3.2.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

applications/sckanner/frontend/src/components/SummaryPage.tsx

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,20 @@ import descriptionsData from '../data/descriptions.json';
1717

1818
const { primaryPurple600, gray500, white } = vars;
1919

20+
const formatDate = (dateStr: string): string => {
21+
const date = new Date(dateStr + 'T00:00:00');
22+
return date.toLocaleDateString('en-US', {
23+
year: 'numeric',
24+
month: 'short',
25+
day: 'numeric',
26+
});
27+
};
28+
2029
const SummaryPage = () => {
2130
const [data, setData] = useState<{ [x: string]: null }>({});
2231
const [loaded, setLoaded] = useState(false);
2332
const [value, setValue] = useState(0);
33+
const [lastUpdated, setLastUpdated] = useState<string>('');
2434

2535
// @ts-expect-error Explanation: Handling Event properly
2636
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
@@ -50,7 +60,14 @@ const SummaryPage = () => {
5060
[FILES.CATEGORY]: null,
5161
};
5262

53-
for (const file in FILES) {
63+
const statFiles = [
64+
FILES.POPULATION,
65+
FILES.PHENOTYPE,
66+
FILES.SPECIES,
67+
FILES.CATEGORY,
68+
];
69+
70+
for (const file of statFiles) {
5471
const request = new XMLHttpRequest();
5572
request.open(
5673
'GET',
@@ -63,7 +80,7 @@ const SummaryPage = () => {
6380
}
6481
}
6582

66-
for (const file in FILES) {
83+
for (const file of statFiles) {
6784
const request = new XMLHttpRequest();
6885
request.open(
6986
'GET',
@@ -196,20 +213,40 @@ const SummaryPage = () => {
196213
}
197214
});
198215

216+
// Fetch version info for "last updated" date
217+
const versionRequest = new XMLHttpRequest();
218+
versionRequest.open(
219+
'GET',
220+
SCKAN_DATABASE_SUMMARY_URL_LATEST + DATABASE_FILES[FILES.INFO],
221+
false,
222+
);
223+
versionRequest.send(null);
224+
if (versionRequest.status === 200) {
225+
const versionData = JSON.parse(versionRequest.responseText);
226+
const dateValue =
227+
versionData?.results?.bindings?.[0]?.sckan_version?.value;
228+
if (dateValue) {
229+
setLastUpdated(formatDate(dateValue));
230+
}
231+
}
232+
199233
setLoaded(true);
200234
setData(results);
201235
}, []);
202236

203237
const getDataPerSection = (section: any) => {
204238
let total = 0;
239+
let totalChange = 0;
205240
const results = section.map((item: any) => {
206241
total += Number(item.count);
242+
totalChange += Number(item.change || 0);
207243
return (
208244
<Detail
209245
keyName={item.label}
210246
value={item.count}
211247
labels={item.label}
212248
index={Math.random()}
249+
change={Number(item.change)}
213250
/>
214251
);
215252
});
@@ -219,6 +256,7 @@ const SummaryPage = () => {
219256
value={total}
220257
labels="Total"
221258
index={Math.random()}
259+
change={totalChange}
222260
/>,
223261
);
224262
return results;
@@ -278,9 +316,11 @@ const SummaryPage = () => {
278316
>
279317
Database summary
280318
</Typography>
281-
<Typography variant="body1" color={gray500}>
282-
Last updated on Apr 24, 2025
283-
</Typography>
319+
{lastUpdated && (
320+
<Typography variant="body1" color={gray500}>
321+
Last updated on {lastUpdated}
322+
</Typography>
323+
)}
284324
</Stack>
285325
<Box
286326
sx={{

applications/sckanner/frontend/src/components/connections/SummaryDetails.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ const SummaryDetails = ({
7474
const getForwardConnections = () => {
7575
const forwardConnections: string[] = [];
7676
connectionDetails?.forwardConnections.forEach((conn) => {
77-
if (conn?.reference_uri !== undefined) {
77+
if (conn?.curie_id !== undefined) {
78+
forwardConnections.push(conn.curie_id);
79+
} else if (conn?.reference_uri !== undefined) {
7880
forwardConnections.push(conn.reference_uri);
7981
}
8082
});
@@ -84,8 +86,8 @@ const SummaryDetails = ({
8486
// Details shown in the dropdown - from composer
8587
const detailsObject = [
8688
{
87-
label: 'Connection Id',
88-
value: connectionDetails?.id || '-',
89+
label: 'Curie ID',
90+
value: connectionDetails?.curie_id || '-',
8991
icon: undefined,
9092
},
9193
{

applications/sckanner/frontend/src/components/summaryPage/Detail.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@ import { Stack, Tooltip, Typography } from '@mui/material';
22
import { vars } from '../../theme/variables.ts';
33
import { HelpCircle } from '../icons/index.tsx';
44
import IconButton from '@mui/material/IconButton';
5-
const { gray700, gray600 } = vars;
5+
const { gray700, gray600, gray500 } = vars;
66

77
interface DetailProps {
88
keyName: string;
99
value: string | number;
1010
labels: string;
1111
index: number;
12+
change?: number;
1213
}
13-
export const Detail = ({ keyName, value, labels, index }: DetailProps) => (
14+
export const Detail = ({
15+
keyName,
16+
value,
17+
labels,
18+
index,
19+
change,
20+
}: DetailProps) => (
1421
<Stack
1522
key={keyName}
1623
direction="row"
@@ -54,17 +61,18 @@ export const Detail = ({ keyName, value, labels, index }: DetailProps) => (
5461
color={gray600}
5562
>
5663
{value}
64+
{change != null && change !== 0 && (
65+
<Typography
66+
component="span"
67+
variant="h5"
68+
fontWeight={400}
69+
color={gray500}
70+
sx={{ marginLeft: '.25rem' }}
71+
>
72+
({change > 0 ? `+${change}` : change})
73+
</Typography>
74+
)}
5775
</Typography>
58-
{/* {sectionData[`${keyName}_changes`] && (
59-
<Typography
60-
variant="body1"
61-
width="23rem"
62-
textAlign="right"
63-
color={gray500}
64-
>
65-
+{sectionData[`${keyName}_changes`]} change (since last stats)
66-
</Typography>
67-
)} */}
6876
</Stack>
6977
</Stack>
7078
);

applications/sckanner/frontend/src/data/database_summary_info.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { COMPOSER_VERSION, NEURONDM_VERSION } from '../settings';
1+
import {
2+
COMPOSER_VERSION,
3+
NEURONDM_VERSION,
4+
SCKANNER_VERSION,
5+
} from '../settings';
26

37
export const sckanInfoText = {
48
summary: {
@@ -40,7 +44,7 @@ export const sckanInfoText = {
4044
versions: {
4145
title: 'Versions',
4246
bulletPoints: [
43-
'SCKANNER Version: 1.0.0-beta',
47+
'SCKANNER Version: ' + SCKANNER_VERSION,
4448
'Composer Version: ' + COMPOSER_VERSION,
4549
'SCKAN Version: ' + NEURONDM_VERSION,
4650
],

applications/sckanner/frontend/src/services/mappers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ interface KnowledgeStatementAPI {
6060
sex: Sex;
6161
statement_preview: string;
6262
statement_alerts: StatementAlert[];
63+
curie_id: string;
6364
}
6465

6566
export function mapApiResponseToKnowledgeStatements(
@@ -112,6 +113,7 @@ export function mapApiResponseToKnowledgeStatements(
112113
sex: ks.sex || {},
113114
statement_preview: ks.statement_preview || '',
114115
statement_alerts: ks.statement_alerts || [],
116+
curie_id: ks.curie_id || '',
115117
}));
116118
}
117119

applications/sckanner/frontend/src/settings.ts

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@ export const SCKAN_ORDER_JSON_URL =
33
export const SCKAN_MAJOR_NERVES_JSON_URL =
44
'https://raw.githubusercontent.com/smtifahim/SCKAN-Apps/refs/heads/master/sckan-explorer/json/major-nerves.json';
55

6-
export const SCKAN_DATABASE_SUMMARY_URL_LATEST =
6+
export const SCKAN_DATABASE_SUMMARY_URL_PREVIOUS =
77
'https://raw.githubusercontent.com/smtifahim/SCKAN-Apps/refs/heads/master/sckan-explorer/json/sckanner-data/stats/sckan-version-2024-09-21/';
88

9-
export const SCKAN_DATABASE_SUMMARY_URL_PREVIOUS =
9+
export const SCKAN_DATABASE_SUMMARY_URL_LATEST =
1010
'https://raw.githubusercontent.com/smtifahim/SCKAN-Apps/refs/heads/master/sckan-explorer/json/sckanner-data/stats/prod/';
1111

1212
export const FILES = {
1313
POPULATION: 'POPULATION',
1414
PHENOTYPE: 'PHENOTYPE',
1515
SPECIES: 'SPECIES',
1616
CATEGORY: 'CATEGORY',
17+
INFO: 'INFO',
1718
};
1819

1920
export const DATABASE_FILES = {
2021
[FILES.POPULATION]: 'stats-model-population-count.json',
2122
[FILES.PHENOTYPE]: 'stats-phenotype-count.json',
2223
[FILES.SPECIES]: 'stats-phenotype-value-count.json',
2324
[FILES.CATEGORY]: 'stats-population-category-count.json',
25+
[FILES.INFO]: 'sckan-version-info.json',
2426
};
2527

2628
export const OTHER_X_AXIS_ID = 'OTHER_X';
@@ -76,6 +78,46 @@ export const STRINGS_NUMBERS = [
7678

7779
// Get version from Vite environment variable (set at build time)
7880
export const SCKANNER_VERSION = import.meta.env.VITE_APP_VERSION || '3.1.1';
79-
export const COMPOSER_VERSION = '6.0.0';
80-
export const NEURONDM_VERSION = '2025-10-27';
81+
82+
const COMPOSER_PACKAGE_JSON_URL =
83+
'https://raw.githubusercontent.com/MetaCell/sckan-composer/refs/heads/main/applications/composer/frontend/package.json';
84+
85+
// Fetch Composer version from its package.json on GitHub
86+
const fetchComposerVersion = (): string => {
87+
try {
88+
const request = new XMLHttpRequest();
89+
request.open('GET', COMPOSER_PACKAGE_JSON_URL, false);
90+
request.send(null);
91+
if (request.status === 200) {
92+
const data = JSON.parse(request.responseText);
93+
return data?.version || '';
94+
}
95+
} catch {
96+
// fallback on error
97+
}
98+
return '';
99+
};
100+
export const COMPOSER_VERSION = fetchComposerVersion();
101+
102+
// Fetch NEURONDM version from remote sckan-version-info.json
103+
const fetchNeurondmVersion = (): string => {
104+
try {
105+
const request = new XMLHttpRequest();
106+
request.open(
107+
'GET',
108+
SCKAN_DATABASE_SUMMARY_URL_LATEST + DATABASE_FILES[FILES.INFO],
109+
false,
110+
);
111+
request.send(null);
112+
if (request.status === 200) {
113+
const data = JSON.parse(request.responseText);
114+
return data?.results?.bindings?.[0]?.sckan_version?.value || '';
115+
}
116+
} catch {
117+
// fallback on error
118+
}
119+
return '';
120+
};
121+
export const NEURONDM_VERSION = fetchNeurondmVersion();
122+
81123
export const KNOWLEDGE_STATEMENTS_BATCH_SIZE = 15;

0 commit comments

Comments
 (0)