Skip to content

Commit

Permalink
Merge pull request #37 from abcd-j/upstream-changes
Browse files Browse the repository at this point in the history
Bring in upstream changes
  • Loading branch information
jsheunis authored May 1, 2024
2 parents b525fdf + 623f7ca commit 955cd01
Show file tree
Hide file tree
Showing 33 changed files with 446 additions and 322 deletions.
8 changes: 4 additions & 4 deletions catalog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ The `artwork` and `assets` directories contain images and web assets (such as Ja

## Serving the content

Since this site is self-contained and static, no further build processes, server-side implementations, or access to content delivery networks (CDNs) are necessary in order to serve the content. All that is needed is a simple HTTP server.
Since this site is self-contained and static, no further build processes or access to content delivery networks (CDNs) are necessary in order to serve the content. All that is needed is a simple HTTP server with one specific addition - a custom redirect. This is required because the application makes use of [Vue Router's history mode](https://v3.router.vuejs.org/guide/essentials/history-mode.html#html5-history-mode), which requires a server-side redirect configuration to deal with the fact that a VueJS application is actually a single-page app.

This can be achieved locally, for example using Python:
For serving the content locally, this is already taken care of in `datalad-catalog`, and you can simply run the following:

```bash
cd path/to/catalog/directory
python3 -m http.server
datalad catalog-serve -c .
```

The content can also be hosted and served online. A straightforward and free way to achieve this is via GitHub and [GitHub Pages](https://pages.github.com/). After publishing this content as a GitHub repository, you can activate GitHub Pages in the repository's settings. See detailed instructions [here](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-github-pages-site).
The content can also be hosted and served online. A straightforward way to achieve this, and one which has a free tier, is via [Netlify](https://www.netlify.com/) (the common alternative, [GitHub Pages](https://pages.github.com/), does not currently support server-side redirects). After publishing this content, e.g. as a GitHub repository, you can link that repository to a site on Netlify. [See here](https://docs.netlify.com/routing/redirects/) how to set up redirects with Netlify. Of course, the site can also be served from your preferred server setup, as long as page redirects can be supported.

## Maintaining content

Expand Down
25 changes: 8 additions & 17 deletions catalog/assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,9 @@ var datacat = new Vue({
gotoExternal(dest) {
window.open(dest);
},
async load() {
// Load templates
await Promise.all(
Object.keys(template_paths).map(async (key, index) => {
url = template_dir + "/" + template_paths[key]
fetch(url).
then(response => {
return response.text();
}).
then(text => {
console.log('template loaded: '+key)
console.log(text)
document.getElementById(key).innerHTML = text;
});
})
)
}
},
beforeCreate() {
console.debug("Executing lifecycle hook: beforeCreate")
fetch(config_file)
.then((response) => {
if (response.ok) {
Expand All @@ -54,6 +38,13 @@ var datacat = new Vue({
})
.then((responseJson) => {
obj = responseJson;
// first ensure that the config has all required fields;
// if some are missing, fill them in from default_config
for (const [key, value] of Object.entries(default_config)) {
if (!obj.hasOwnProperty(key) ) {
obj[key] = value;
}
}
// set social links
this.social_links = obj.social_links
// set dataset options
Expand Down
323 changes: 244 additions & 79 deletions catalog/assets/app_component_dataset.js

Large diffs are not rendered by default.

33 changes: 21 additions & 12 deletions catalog/assets/app_globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const default_config = {
logo_path: "/artwork/catalog_logo.svg",
social_links: {
about: null,
documentation: null,
github: null,
mastodon: null,
x: null
documentation: "https://docs.datalad.org/projects/catalog/en/latest/",
github: "https://github.com/datalad/datalad-catalog",
mastodon: "https://fosstodon.org/@datalad",
x: "https://x.com/datalad"
},
dataset_options: {
include_metadata_export: true,
Expand Down Expand Up @@ -56,15 +56,24 @@ async function grabSubDatasets(app) {
function getFilePath(dataset_id, dataset_version, path, ext = ".json") {
// Get node file location from dataset id, dataset version, and node path
// using a file system structure similar to RIA stores
file = metadata_dir + "/" + dataset_id + "/" + dataset_version;
blob = dataset_id + "-" + dataset_version;
if (path) {
blob = blob + "-" + path;
// - dataset_id is required, all the other parameters are optional
// - dataset_id could either be an actual dataset ID or an alias
file = metadata_dir + "/" + dataset_id
blob = dataset_id
if (dataset_version) {
file = file + "/" + dataset_version;
blob = blob + "-" + dataset_version;
// path to file only makes sense with the context of a dataset id AND version
if (path) {
blob = blob + "-" + path;
}
blob = md5(blob);
blob_parts = [blob.substring(0, SPLIT_INDEX), blob.substring(SPLIT_INDEX)];
return file + "/" + blob_parts[0] + "/" + blob_parts[1] + ext;
} else {
blob = md5(blob);
return file + "/" + blob + ext;
}
blob = md5(blob);
blob_parts = [blob.substring(0, SPLIT_INDEX), blob.substring(SPLIT_INDEX)];
file = file + "/" + blob_parts[0] + "/" + blob_parts[1] + ext;
return file;
}

function getRelativeFilePath(dataset_id, dataset_version, path) {
Expand Down
6 changes: 4 additions & 2 deletions catalog/assets/app_router.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const routes = [
path: "/",
name: "home",
beforeEnter: (to, from, next) => {
console.debug("Executing navigation guard: beforeEnter - route '/')")
const superfile = metadata_dir + "/super.json";
// https://www.dummies.com/programming/php/using-xmlhttprequest-class-properties/
var rawFile = new XMLHttpRequest();
Expand All @@ -22,6 +23,7 @@ const routes = [
dataset_id: superds["dataset_id"],
dataset_version: superds["dataset_version"],
},
query: to.query,
});
next();
} else if (rawFile.status === 404) {
Expand All @@ -36,7 +38,7 @@ const routes = [
},
},
{
path: "/dataset/:dataset_id/:dataset_version/:tab_name?",
path: "/dataset/:dataset_id/:dataset_version?",
component: datasetView,
name: "dataset",
},
Expand All @@ -45,7 +47,7 @@ const routes = [
path: '/:catchAll(.*)',
component: notFound,
name: '404'
}
},
];

// Create router
Expand Down
2 changes: 1 addition & 1 deletion catalog/assets/brands.min.css

Large diffs are not rendered by default.

Binary file modified catalog/assets/fa-brands-400.woff2
Binary file not shown.
Binary file modified catalog/assets/fa-regular-400.woff2
Binary file not shown.
Binary file modified catalog/assets/fa-solid-900.woff2
Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "0036b2c6-f131-4660-9ef9-945087ad02d3", "dataset_version": "1139b4c82d7ecd0d9ab25bf4c00ec2c06461d6da"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type": "dataset", "dataset_id": "1015ed7c-0a3d-4dfc-9c4f-11fe71673a41", "dataset_version": "656a74dd70558c5eb834d79f80db5884ff8caeb7", "children": [{"type": "directory", "name": "FZJ", "path": "FZJ"}, {"type": "directory", "name": "UKD", "path": "UKD"}], "metadata_sources": {"key_source_map": {"type": ["catalog_core"], "dataset_id": ["catalog_core"], "dataset_version": ["catalog_core"], "url": ["catalog_core", "tabby"], "authors": ["tabby"], "name": ["tabby"], "description": ["tabby"], "keywords": ["tabby"], "funding": ["tabby"], "subdatasets": ["tabby"], "additional_display": ["tabby"]}, "sources": [{"source_name": "catalog_core", "source_version": "1", "source_parameter": {}, "source_time": 1713263552.4326751, "agent_email": "t.heunis@fz-juelich.de", "agent_name": "Tosca Heunis"}, {"source_name": "tabby", "source_version": "0.1.0", "source_parameter": {}, "source_time": 1713263552.470434, "agent_name": "Tosca Heunis", "agent_email": "t.heunis@fz-juelich.de"}]}, "url": ["ssh://git@github.com/~/abcd-j/data.git", "https://www.abcd-j.de/", "https://github.com/abcd-j/data.git"], "authors": [{"name": "ABCD-J Research Consortium"}], "name": "The ABCD-J Data Catalog", "description": "This data catalog contains datasets from the ABCD-J research community project, officially titled \u201cVerbundprojekt: Accessing Behavior for Clinical Data and Joint usage (ABCD-J) - Eine Plattform f\u00fcr Verhaltensmarker der digitalen Neuromedizin in NRW\u201d. This project is a collaboration between five research institutions in the German state of North Rhine-Westphalia: University Clinic RWTH Aachen, University Clinic Bonn, University Clinic K\u00f6ln, University Clinic D\u00fcsseldorf and Research Centre J\u00fclich. The overarching goal of ABCD-J is to elevate existing technical solutions for research practice adoption. From the social perspective, the ABCD-J project aims to promote and facilitate collaboration between multiple research centres, while from the technical perspective the project will accelerate research through homogenization of workflows and processes, with particular emphasis on digital biomarker development.", "keywords": ["Aachen", "Bonn", "Cologne", "D\u00fcsseldorf", "J\u00fclich", "Collaboration", "Research", "Open data", "FAIR", "Biomarker", "Clinical", "Behaviour"], "funding": [{"@type": "schema:Grant", "name": "MKW-NRW: Ministerium f\u00fcr Kultur und Wissenschaft des Landes Nordrhein-Westfalen", "identifier": "Kooperationsplattformen 2022: KP22-106A", "schema:url": "https://www.mkw.nrw/"}], "subdatasets": [{"dataset_id": "3f8a45c0-08fc-479c-b561-cb6f744d2b5c", "dataset_version": "32f3303308c89b037fe1700547348470539a30cb", "dataset_path": "FZJ/jumax", "dataset_url": null, "dirs_from_path": ["FZJ", "jumax"]}, {"dataset_id": "0036b2c6-f131-4660-9ef9-945087ad02d3", "dataset_version": "1139b4c82d7ecd0d9ab25bf4c00ec2c06461d6da", "dataset_path": "FZJ/movies", "dataset_url": null, "dirs_from_path": ["FZJ", "movies"]}, {"dataset_id": "db7592d0-6206-5684-a29c-8059a6033241", "dataset_version": "0.1.0", "dataset_path": "UKD/ocr-PIRA-cohort", "dataset_url": null, "dirs_from_path": ["UKD", "ocr-PIRA-cohort"]}, {"dataset_id": "372e66b3-e654-4a0f-ba4c-6394bf314f2f", "dataset_version": "d468e9a9455b38b959db34bc5335fd66e42b2884", "dataset_path": "FZJ/EMA_Pilot", "dataset_url": null, "dirs_from_path": ["FZJ", "EMA_Pilot"]}, {"dataset_id": "d72933c1-a660-5970-8bfd-48fcdac59dc5", "dataset_version": "latest", "dataset_path": "UKD/Gliem-Pavic", "dataset_url": "https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE167274", "dirs_from_path": ["UKD", "Gliem-Pavic"]}, {"dataset_id": "c0ebe952-528e-40c8-a44f-4a80bff28ffb", "dataset_version": "4f5d78d24e6be85d26e22fbc088b2d8469163758", "dataset_path": "FZJ/SpEx", "dataset_url": "https://data.fz-juelich.de/dataset.xhtml?persistentId=doi:10.26165/JUELICH-DATA/CHWZDZ", "dirs_from_path": ["FZJ", "SpEx"]}], "additional_display": [{"name": "ABCD-J", "icon": "fa-solid fa-graduation-cap", "content": {"@context": {"homepage": "https://schema.org/mainEntityOfPage", "data controller": "https://w3id.org/dpv#hasDataController", "sample (organism)": "https://openminds.ebrains.eu/controlledTerms/Species", "sample (organism part)": "https://openminds.ebrains.eu/controlledTerms/UBERONParcellation", "used for": "http://www.w3.org/ns/prov#hadUsage"}, "homepage": {"@type": "https://schema.org/URL", "@value": "https://www.abcd-j.de/"}}}]}
{"type": "dataset", "dataset_id": "1015ed7c-0a3d-4dfc-9c4f-11fe71673a41", "dataset_version": "656a74dd70558c5eb834d79f80db5884ff8caeb7", "children": [{"type": "directory", "name": "FZJ", "path": "FZJ"}, {"type": "directory", "name": "UKD", "path": "UKD"}], "metadata_sources": {"key_source_map": {"type": ["catalog_core"], "dataset_id": ["catalog_core"], "dataset_version": ["catalog_core"], "url": ["catalog_core", "tabby"], "authors": ["tabby"], "name": ["tabby"], "description": ["tabby"], "keywords": ["tabby"], "funding": ["tabby"], "subdatasets": ["tabby"], "additional_display": ["tabby"], "alias": ["automated_alias_entry"]}, "sources": [{"source_name": "catalog_core", "source_version": "1", "source_parameter": {}, "source_time": 1713263552.4326751, "agent_email": "t.heunis@fz-juelich.de", "agent_name": "Tosca Heunis"}, {"source_name": "tabby", "source_version": "0.1.0", "source_parameter": {}, "source_time": 1713263552.470434, "agent_name": "Tosca Heunis", "agent_email": "t.heunis@fz-juelich.de"}, {"source_name": "automated_alias_entry", "source_version": "0.1.0", "source_parameter": {}, "source_time": 1714298033.906975, "agent_name": "Stephan Heunis", "agent_email": "s.heunis@fz-juelich.de"}]}, "url": ["ssh://git@github.com/~/abcd-j/data.git", "https://www.abcd-j.de/", "https://github.com/abcd-j/data.git"], "authors": [{"name": "ABCD-J Research Consortium"}], "name": "The ABCD-J Data Catalog", "description": "This data catalog contains datasets from the ABCD-J research community project, officially titled \u201cVerbundprojekt: Accessing Behavior for Clinical Data and Joint usage (ABCD-J) - Eine Plattform f\u00fcr Verhaltensmarker der digitalen Neuromedizin in NRW\u201d. This project is a collaboration between five research institutions in the German state of North Rhine-Westphalia: University Clinic RWTH Aachen, University Clinic Bonn, University Clinic K\u00f6ln, University Clinic D\u00fcsseldorf and Research Centre J\u00fclich. The overarching goal of ABCD-J is to elevate existing technical solutions for research practice adoption. From the social perspective, the ABCD-J project aims to promote and facilitate collaboration between multiple research centres, while from the technical perspective the project will accelerate research through homogenization of workflows and processes, with particular emphasis on digital biomarker development.", "keywords": ["Aachen", "Bonn", "Cologne", "D\u00fcsseldorf", "J\u00fclich", "Collaboration", "Research", "Open data", "FAIR", "Biomarker", "Clinical", "Behaviour"], "funding": [{"@type": "schema:Grant", "name": "MKW-NRW: Ministerium f\u00fcr Kultur und Wissenschaft des Landes Nordrhein-Westfalen", "identifier": "Kooperationsplattformen 2022: KP22-106A", "schema:url": "https://www.mkw.nrw/"}], "subdatasets": [{"dataset_id": "3f8a45c0-08fc-479c-b561-cb6f744d2b5c", "dataset_version": "32f3303308c89b037fe1700547348470539a30cb", "dataset_path": "FZJ/jumax", "dataset_url": null, "dirs_from_path": ["FZJ", "jumax"]}, {"dataset_id": "0036b2c6-f131-4660-9ef9-945087ad02d3", "dataset_version": "1139b4c82d7ecd0d9ab25bf4c00ec2c06461d6da", "dataset_path": "FZJ/movies", "dataset_url": null, "dirs_from_path": ["FZJ", "movies"]}, {"dataset_id": "db7592d0-6206-5684-a29c-8059a6033241", "dataset_version": "0.1.0", "dataset_path": "UKD/ocr-PIRA-cohort", "dataset_url": null, "dirs_from_path": ["UKD", "ocr-PIRA-cohort"]}, {"dataset_id": "372e66b3-e654-4a0f-ba4c-6394bf314f2f", "dataset_version": "d468e9a9455b38b959db34bc5335fd66e42b2884", "dataset_path": "FZJ/EMA_Pilot", "dataset_url": null, "dirs_from_path": ["FZJ", "EMA_Pilot"]}, {"dataset_id": "d72933c1-a660-5970-8bfd-48fcdac59dc5", "dataset_version": "latest", "dataset_path": "UKD/Gliem-Pavic", "dataset_url": "https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE167274", "dirs_from_path": ["UKD", "Gliem-Pavic"]}, {"dataset_id": "c0ebe952-528e-40c8-a44f-4a80bff28ffb", "dataset_version": "4f5d78d24e6be85d26e22fbc088b2d8469163758", "dataset_path": "FZJ/SpEx", "dataset_url": "https://data.fz-juelich.de/dataset.xhtml?persistentId=doi:10.26165/JUELICH-DATA/CHWZDZ", "dirs_from_path": ["FZJ", "SpEx"]}], "additional_display": [{"name": "ABCD-J", "icon": "fa-solid fa-graduation-cap", "content": {"@context": {"homepage": "https://schema.org/mainEntityOfPage", "data controller": "https://w3id.org/dpv#hasDataController", "sample (organism)": "https://openminds.ebrains.eu/controlledTerms/Species", "sample (organism part)": "https://openminds.ebrains.eu/controlledTerms/UBERONParcellation", "used for": "http://www.w3.org/ns/prov#hadUsage"}, "homepage": {"@type": "https://schema.org/URL", "@value": "https://www.abcd-j.de/"}}}], "alias": "abcdj"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "1015ed7c-0a3d-4dfc-9c4f-11fe71673a41", "dataset_version": "656a74dd70558c5eb834d79f80db5884ff8caeb7"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "372e66b3-e654-4a0f-ba4c-6394bf314f2f", "dataset_version": "d468e9a9455b38b959db34bc5335fd66e42b2884"}
Loading

0 comments on commit 955cd01

Please sign in to comment.