Commit 47c6c415 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

About

parent 07effaf8
...@@ -2,12 +2,13 @@ import React, { useContext, useLayoutEffect, useRef, useCallback, useEffect } fr ...@@ -2,12 +2,13 @@ import React, { useContext, useLayoutEffect, useRef, useCallback, useEffect } fr
import {ReactComponent as AboutSvg} from './about.svg' import {ReactComponent as AboutSvg} from './about.svg'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Markdown from './Markdown' import Markdown from './Markdown'
import { appBase, optimadeBase, apiBase, debug, consent } from '../config' import { appBase, optimadeBase, apiBase, debug, consent, aitoolkitEnabled, encyclopediaEnabled } from '../config'
import { apiContext } from './api' import { apiContext } from './api'
import packageJson from '../../package.json' import packageJson from '../../package.json'
import { domains } from './domains' import { domains } from './domains'
import { Grid, Card, CardContent, Typography, makeStyles, Link } from '@material-ui/core' import { Grid, Card, CardContent, Typography, makeStyles, Link } from '@material-ui/core'
import { Link as RouterLink, useHistory } from 'react-router-dom' import { Link as RouterLink, useHistory } from 'react-router-dom'
import tutorials from './aitoolkit/tutorials'
export const CodeList = () => { export const CodeList = () => {
const {info} = useContext(apiContext) const {info} = useContext(apiContext)
...@@ -97,10 +98,18 @@ export default function About() { ...@@ -97,10 +98,18 @@ export default function About() {
history.push('/upload') history.push('/upload')
}) })
makeClickable('encyclopedia', () => { makeClickable('encyclopedia', () => {
window.location.href = 'https://encyclopedia.nomad-coe.eu/gui/#/search' if (encyclopediaEnabled) {
window.location.href = `${appBase}/encyclopedia`
} else {
window.location.href = 'https://encyclopedia.nomad-coe.eu/gui/#/search'
}
}) })
makeClickable('analytics', () => { makeClickable('toolkit', () => {
window.location.href = 'https://nomad-lab.eu/AItutorials' if (aitoolkitEnabled) {
history.push('/aitoolkit')
} else {
window.location.href = 'https://nomad-lab.eu/tools/AItutorials'
}
}) })
makeClickable('search', () => { makeClickable('search', () => {
history.push('/search') history.push('/search')
...@@ -109,6 +118,7 @@ export default function About() { ...@@ -109,6 +118,7 @@ export default function About() {
useEffect(() => { useEffect(() => {
const statistics = (info && info.statistics) || {} const statistics = (info && info.statistics) || {}
statistics.n_tutorials = tutorials.tutorials.length
const value = (key, unit) => { const value = (key, unit) => {
const nominal = statistics[key] const nominal = statistics[key]
let stringValue = null let stringValue = null
...@@ -117,8 +127,10 @@ export default function About() { ...@@ -117,8 +127,10 @@ export default function About() {
stringValue = Math.floor(nominal / 1.0e+9) + ' bln.' stringValue = Math.floor(nominal / 1.0e+9) + ' bln.'
} else if (nominal >= 1.0e+6) { } else if (nominal >= 1.0e+6) {
stringValue = Math.floor(nominal / 1.0e+6) + ' mln.' stringValue = Math.floor(nominal / 1.0e+6) + ' mln.'
} else { } else if (nominal >= 1.0e+3) {
stringValue = Math.floor(nominal / 1.0e+3) + ' tsd.' stringValue = Math.floor(nominal / 1.0e+3) + ' tsd.'
} else {
stringValue = nominal.toString()
} }
return `${stringValue || '...'} ${unit}` return `${stringValue || '...'} ${unit}`
} else { } else {
...@@ -133,6 +145,12 @@ export default function About() { ...@@ -133,6 +145,12 @@ export default function About() {
value('n_calculations', 'results'), value('n_calculations', 'results'),
value('n_quantities', 'quantities') value('n_quantities', 'quantities')
]) ])
setText('encStats', [
value('n_materials', 'materials')
])
setText('toolkitStats', [
value('n_tutorials', 'notebooks')
])
}, [svg, info, setText]) }, [svg, info, setText])
return <div className={classes.root}> return <div className={classes.root}>
......
...@@ -39,7 +39,7 @@ import {matomo} from '../index' ...@@ -39,7 +39,7 @@ import {matomo} from '../index'
import { useCookies } from 'react-cookie' import { useCookies } from 'react-cookie'
import Markdown from './Markdown' import Markdown from './Markdown'
import { help as metainfoHelp, MetainfoPage } from './archive/MetainfoBrowser' import { help as metainfoHelp, MetainfoPage } from './archive/MetainfoBrowser'
import AnalyticsPage from './analytics/AnalyticsPage' import AIToolkitPage from './aitoolkit/AIToolkitPage'
export const ScrollContext = React.createContext({scrollParentRef: null}) export const ScrollContext = React.createContext({scrollParentRef: null})
...@@ -279,9 +279,9 @@ function MainMenu() { ...@@ -279,9 +279,9 @@ function MainMenu() {
icon={<UserDataIcon/>} icon={<UserDataIcon/>}
/> />
{!oasis && aitoolkitEnabled && <MainMenuItem {!oasis && aitoolkitEnabled && <MainMenuItem
title="Analytics" title="AI Toolkit"
path="/analytics" path="/aitoolkit"
tooltip="NOMAD's analytics (AI) toolkit tutorial jupyter notebooks" tooltip="NOMAD's Artificial Intelligence Toolkit tutorial jupyter notebooks"
icon={<AnalyticsIcon/>} icon={<AnalyticsIcon/>}
/>} />}
<MainMenuItem <MainMenuItem
...@@ -559,9 +559,9 @@ const routes = { ...@@ -559,9 +559,9 @@ const routes = {
path: '/metainfo', path: '/metainfo',
component: MetainfoPage component: MetainfoPage
}, },
'analytics': { 'aitoolkit': {
path: '/analytics', path: '/aitoolkit',
component: AnalyticsPage component: AIToolkitPage
} }
} }
......
This diff is collapsed.
...@@ -41,7 +41,7 @@ const useStyles = makeStyles(theme => ({ ...@@ -41,7 +41,7 @@ const useStyles = makeStyles(theme => ({
} }
})) }))
export default function AnalyticsPage() { export default function AIToolkitPage() {
const classes = useStyles() const classes = useStyles()
const [expanded, setExpanded] = useQueryParam('expanded', StringParam) const [expanded, setExpanded] = useQueryParam('expanded', StringParam)
const [queryParameters, setQueryParameters] = useQueryParams({ const [queryParameters, setQueryParameters] = useQueryParams({
...@@ -96,12 +96,12 @@ export default function AnalyticsPage() { ...@@ -96,12 +96,12 @@ export default function AnalyticsPage() {
return <Grid container spacing={2} className={classes.root}> return <Grid container spacing={2} className={classes.root}>
<Grid item xs={12}> <Grid item xs={12}>
<Markdown>{` <Markdown>{`
# NOMAD Analytics (AI) Toolkit # NOMAD Artificial Intelligence Toolkit
We develop and implement methods that identify correlations and structure in big data We develop and implement methods that identify correlations and structure in big data
of materials. This will enable scientists and engineers to decide which materials are of materials. This will enable scientists and engineers to decide which materials are
useful for specific applications or which new materials should be the focus of future studies. useful for specific applications or which new materials should be the focus of future studies.
The following tutorials are designed to get started with the Analytics Toolkit. The following tutorials are designed to get started with the AI Toolkit.
To log in directly, click [here](https://analytics-toolkit.nomad-coe.eu/hub). To log in directly, click [here](https://analytics-toolkit.nomad-coe.eu/hub).
`}</Markdown> `}</Markdown>
......
...@@ -50,6 +50,7 @@ statistics_info_model = api.model('StatisticsInfo', { ...@@ -50,6 +50,7 @@ statistics_info_model = api.model('StatisticsInfo', {
'n_uploads': fields.Integer(description='Number of uploads in NOMAD'), 'n_uploads': fields.Integer(description='Number of uploads in NOMAD'),
'n_quantities': fields.Integer(description='Accumulated number of quantities over all entries in the Archive'), 'n_quantities': fields.Integer(description='Accumulated number of quantities over all entries in the Archive'),
'n_calculations': fields.Integer(description='Accumulated number of calculations, e.g. total energy calculations in the Archive'), 'n_calculations': fields.Integer(description='Accumulated number of calculations, e.g. total energy calculations in the Archive'),
'n_materials': fields.Integer(description='Number of materials in NOMAD')
# TODO # TODO
# 'raw_file_size': fields.Integer(description='Total amount of raw files in TB'), # 'raw_file_size': fields.Integer(description='Total amount of raw files in TB'),
# 'archive_file_size': fields.Integer(description='Total amount of binary archive data in TB') # 'archive_file_size': fields.Integer(description='Total amount of binary archive data in TB')
......
...@@ -513,6 +513,8 @@ class SearchRequest: ...@@ -513,6 +513,8 @@ class SearchRequest:
'global_statistics:n_calculations', A('sum', field='dft.n_calculations')) 'global_statistics:n_calculations', A('sum', field='dft.n_calculations'))
self._search.aggs.metric( self._search.aggs.metric(
'global_statistics:n_quantities', A('sum', field='dft.n_quantities')) 'global_statistics:n_quantities', A('sum', field='dft.n_quantities'))
self._search.aggs.metric(
'global_statistics:n_materials', A('cardinality', field='encyclopedia.material.material_id'))
return self return self
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment