diff --git a/README.md b/README.md index b5254a5..5d75b98 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,4 @@ This repository previously contained substantial other material, such as metadat such as [openMINDS](https://openminds-documentation.readthedocs.io/). ### Acknowledgements -This open source software code was developed in part or in whole in the Human Brain Project, funded from the European Union's Horizon 2020 Framework Programme for Research and Innovation under Specific Grant Agreements 720270, 785907 and 945539 (Human Brain Project SGA1, SGA2 and SGA3). +This open source software code was developed in part or in whole in the Human Brain Project, funded from the European Union's Horizon 2020 Framework Programme for Research and Innovation under Specific Grant Agreements 720270, 785907 and 945539 (Human Brain Project SGA1, SGA2 and SGA3), and in EBRAINS 2.0, funded from the EU Horizon Europe programme under grant agreement 101147319. diff --git a/apps/nar-v3/README.md b/apps/nar-v3/README.md new file mode 100644 index 0000000..3bde033 --- /dev/null +++ b/apps/nar-v3/README.md @@ -0,0 +1,32 @@ +# Neural Activity Resource app + +Code for the Neural Activity Resource app. + +This is an experimental interface for in-depth metadata in the [EBRAINS Knowledge Graph](https://kg.ebrains.eu). +It is not yet intended for public use. + +Copyright 2017, Centre National de la Recherche Scientifique and Forschungszentrum Jülich; +Copyright 2018-2024 Centre National de la Recherche Scientifique + +Code is licenced under the Apache 2.0 licence. + +## Developers' Guide + +The main code repository is https://gitlab.ebrains.eu/data-services/neural-activity-resource. + +The app is implemented using React Router v6, with Material UI for layout and design. +Data are retrieved from the EBRAINS Knowledge Graph using the [KG Core API](https://docs.kg.ebrains.eu/). + +To run a development server, you will need to obtain an EBRAINS IAM authorization token, +paste it into src/main.jsx, then run: + + $ npm run dev + +### Deployment + +The app is deployed to https://nar.apps.tc.humanbrainproject.eu using Kubernetes. +See the "deployment" folder and .gitlab-ci.yml for more details. + + +## Acknowledgements +This open source software code was developed in part or in whole in the Human Brain Project, funded from the European Union's Horizon 2020 Framework Programme for Research and Innovation under Specific Grant Agreement 945539 (Human Brain Project SGA3), and in EBRAINS 2.0, funded from the EU Horizon Europe programme under grant agreement 101147319. diff --git a/apps/nar-v3/src/auth.js b/apps/nar-v3/src/auth.js index f1c18b4..8b41c64 100644 --- a/apps/nar-v3/src/auth.js +++ b/apps/nar-v3/src/auth.js @@ -1,3 +1,25 @@ +/* +This file contains functions for authentication. + +It is based on code written by the Collaboratory team at EBRAINS AISBL, formerly at EPFL. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import Keycloak from "keycloak-js"; // We start by configuring the Keycloak javascript client diff --git a/apps/nar-v3/src/components/ControlledTerm.jsx b/apps/nar-v3/src/components/ControlledTerm.jsx index 25a10c5..63e96e7 100644 --- a/apps/nar-v3/src/components/ControlledTerm.jsx +++ b/apps/nar-v3/src/components/ControlledTerm.jsx @@ -1,3 +1,28 @@ +/* +The Controlled Term component provides a rich display of information +about a term from the openMINDS controlled terminologies. + +At present, it displays the standardised name of the term. + +TODO: add links to external resources, such an ontology definitions. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import Tooltip from "@mui/material/Tooltip"; function ControlledTerm(props) { diff --git a/apps/nar-v3/src/components/DatasetList.jsx b/apps/nar-v3/src/components/DatasetList.jsx index 6b7c421..d0927aa 100644 --- a/apps/nar-v3/src/components/DatasetList.jsx +++ b/apps/nar-v3/src/components/DatasetList.jsx @@ -1,3 +1,22 @@ +/* +The DatasetList component displays a table with summary information +about datasets, and links to the individual dataset views. + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + import { Link as RouterLink } from "react-router-dom"; import Table from "@mui/material/Table"; import TableBody from "@mui/material/TableBody"; diff --git a/apps/nar-v3/src/components/KeyValueTable.jsx b/apps/nar-v3/src/components/KeyValueTable.jsx index fcff58c..03c918d 100644 --- a/apps/nar-v3/src/components/KeyValueTable.jsx +++ b/apps/nar-v3/src/components/KeyValueTable.jsx @@ -1,3 +1,24 @@ +/* +The KeyValueTable component represents the content of a dictionary +as a table. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import { isValidElement } from "react"; import { Table, TableBody, TableRow, TableCell } from "@mui/material"; diff --git a/apps/nar-v3/src/components/Navigation.jsx b/apps/nar-v3/src/components/Navigation.jsx index a31c683..4f12284 100644 --- a/apps/nar-v3/src/components/Navigation.jsx +++ b/apps/nar-v3/src/components/Navigation.jsx @@ -1,3 +1,27 @@ +/* +This file provides several components used in navigating the app: + + Navigation - a "breadcrumb" style bar showing where the user is in the app + NavigateNext - a CSS button for moving to the next item in a list + NavigatePrevious - a CSS button for moving to the previous item in a list + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import { Link, Typography, Toolbar, Breadcrumbs } from "@mui/material"; import { Link as RouterLink, useLocation } from "react-router-dom"; diff --git a/apps/nar-v3/src/components/PatchClampRecordingCard.jsx b/apps/nar-v3/src/components/PatchClampRecordingCard.jsx index 500108a..348d7b4 100644 --- a/apps/nar-v3/src/components/PatchClampRecordingCard.jsx +++ b/apps/nar-v3/src/components/PatchClampRecordingCard.jsx @@ -1,3 +1,24 @@ +/* +The PatchClampRecordingCard component displays metadata about recordings +from an individual neuron using the patch clamp technique. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import Link from "@mui/material/Link"; import { uuidFromUri } from "../utility.js"; diff --git a/apps/nar-v3/src/components/PatchClampRecordingList.jsx b/apps/nar-v3/src/components/PatchClampRecordingList.jsx index 9672c5c..32f8502 100644 --- a/apps/nar-v3/src/components/PatchClampRecordingList.jsx +++ b/apps/nar-v3/src/components/PatchClampRecordingList.jsx @@ -1,3 +1,23 @@ +/* +The PatchClampRecordinList component displays a list of neurons +whose activity has been recorded using the patch clamp technique. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + import { Link as RouterLink } from "react-router-dom"; function uuidFromUri(uri) { diff --git a/apps/nar-v3/src/datastore.js b/apps/nar-v3/src/datastore.js index 1758767..9c61b27 100644 --- a/apps/nar-v3/src/datastore.js +++ b/apps/nar-v3/src/datastore.js @@ -1,3 +1,23 @@ +/* +This file contains functions for retrieving data from the KG Core API of the +EBRAINS Knowledge Graph. It also contains a cache, to reduce the number of requests. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + import { kgUrl, kgDefaultStage } from "./globals"; //import examplePatchClampData from "./example_data/example_patch_clamp_dataset.json"; diff --git a/apps/nar-v3/src/main.jsx b/apps/nar-v3/src/main.jsx index daf67af..a1fa59d 100644 --- a/apps/nar-v3/src/main.jsx +++ b/apps/nar-v3/src/main.jsx @@ -1,3 +1,24 @@ +/* +This is the main entry point to the Neural Activity Resource app, +which is built with React Router v6, using the data loader pattern. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import React from "react"; import ReactDOM from "react-dom/client"; import { createBrowserRouter, RouterProvider } from "react-router-dom"; diff --git a/apps/nar-v3/src/queries.js b/apps/nar-v3/src/queries.js index 4be20e7..75d7e7b 100644 --- a/apps/nar-v3/src/queries.js +++ b/apps/nar-v3/src/queries.js @@ -1,3 +1,27 @@ +/* +This file contains functions for building queries for the KG Core API +of the EBRAINS Knowledge Graph. + +These functions are used in routes/queryLibrary.js to create a library +of pre-defined queries, which are then used by the functions in datastore.js +to retrieve data from the KG. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + function buildKGQuery(baseType, structure) { return { "@context": { diff --git a/apps/nar-v3/src/routes/dataset.jsx b/apps/nar-v3/src/routes/dataset.jsx index 1ba3edc..a8eb2a0 100644 --- a/apps/nar-v3/src/routes/dataset.jsx +++ b/apps/nar-v3/src/routes/dataset.jsx @@ -1,3 +1,23 @@ +/* +The dataset route displays the metadata for a single dataset. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import React from "react"; import { Await, defer, useLoaderData } from "react-router-dom"; diff --git a/apps/nar-v3/src/routes/datasets.jsx b/apps/nar-v3/src/routes/datasets.jsx index 1e9e3b2..8139f49 100644 --- a/apps/nar-v3/src/routes/datasets.jsx +++ b/apps/nar-v3/src/routes/datasets.jsx @@ -1,3 +1,24 @@ +/* +The datasets route displays a table with summary information +from all suitable "neural activity" datasets in the EBRAINS Knowledge Graph. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import React from "react"; import { Await, defer, useLoaderData } from "react-router-dom"; diff --git a/apps/nar-v3/src/routes/home.jsx b/apps/nar-v3/src/routes/home.jsx index 67900da..612f983 100644 --- a/apps/nar-v3/src/routes/home.jsx +++ b/apps/nar-v3/src/routes/home.jsx @@ -1,3 +1,24 @@ +/* +The home route is the entry point to the Neural Activity Resource app. +It has links to different ways of viewing the metadata in the EBRAINS Knowledge Graph. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import React from "react"; import { Await, defer, useLoaderData, Link as RouterLink } from "react-router-dom"; diff --git a/apps/nar-v3/src/routes/patchClampRecording.jsx b/apps/nar-v3/src/routes/patchClampRecording.jsx index 43557bc..44b802b 100644 --- a/apps/nar-v3/src/routes/patchClampRecording.jsx +++ b/apps/nar-v3/src/routes/patchClampRecording.jsx @@ -1,3 +1,24 @@ +/* +The "patch clamp recording" route displays metadata about recordings from +single neurons. Each page shows the recordings from one individual neuron. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + import React from "react"; import { Await, defer, useLoaderData } from "react-router-dom"; diff --git a/apps/nar-v3/src/routes/patchClampRecordings.jsx b/apps/nar-v3/src/routes/patchClampRecordings.jsx index bff9b4a..66f8497 100644 --- a/apps/nar-v3/src/routes/patchClampRecordings.jsx +++ b/apps/nar-v3/src/routes/patchClampRecordings.jsx @@ -1,3 +1,23 @@ +/* +The "patch clamp recordings" route displays a list of neurons that have been +recorded from using the patch clamp technique. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + import React from "react"; import { Await, defer, useLoaderData } from "react-router-dom"; diff --git a/apps/nar-v3/src/routes/queryLibrary.js b/apps/nar-v3/src/routes/queryLibrary.js index 11ab5a8..9e6c8a8 100644 --- a/apps/nar-v3/src/routes/queryLibrary.js +++ b/apps/nar-v3/src/routes/queryLibrary.js @@ -1,3 +1,31 @@ +/* +This file contains a library of queries for the KG Core API of the +EBRAINS Knowledge Graph. + +These queries (which have the form of JSON-LD documents) are built using +an internal API provided by queries.js: + simpleProperty ("S") - for metadata with simple datatypes, such as strings, numbers + linkProperty ("L") - for traversing forward links in the graph + reverseLinkProperty ("R") - for traversing backward links in the graph + +The queries are used by the functions in datastore.js to retrieve data from the KG. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + import { buildKGQuery, simpleProperty as S, @@ -7,6 +35,9 @@ import { const MULTIPLE = { expectSingle: false }; +// Define some lists of properties that are used in multiple queries, +// and/or in multiple places in a single query. + const actorProperties = [ S("@id"), S("@type"), @@ -90,6 +121,8 @@ const basicDatasetProperties = [ ...[L("ethicsAssessment/name"), L("license/shortName"), S("releaseDate")], ]; +// The library of pre-defined queries + const ephysDatasetsQuery = buildKGQuery("core/DatasetVersion", [ ...minimalDatasetProperties, ...[ diff --git a/apps/nar-v3/src/utility.js b/apps/nar-v3/src/utility.js index 4143be7..3955ff9 100644 --- a/apps/nar-v3/src/utility.js +++ b/apps/nar-v3/src/utility.js @@ -1,3 +1,23 @@ +/* +This file contains utility functions for data display. + + +Copyright 2024 Andrew P. Davison, CNRS + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + const UNITS_SYMBOLS = { "degree Celsius": "℃", micrometer: "µm",