Skip to content

Commit

Permalink
Merge pull request #430 from datalad/aliases
Browse files Browse the repository at this point in the history
Towards more user-friendly navigation using aliases and ID concepts
  • Loading branch information
jsheunis authored Apr 27, 2024
2 parents 6c0195b + 3f3963d commit 53ac02a
Show file tree
Hide file tree
Showing 55 changed files with 733 additions and 102 deletions.
18 changes: 1 addition & 17 deletions datalad_catalog/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 Down
240 changes: 216 additions & 24 deletions datalad_catalog/catalog/assets/app_component_dataset.js

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions datalad_catalog/catalog/assets/app_globals.js
Original file line number Diff line number Diff line change
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
4 changes: 3 additions & 1 deletion datalad_catalog/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 Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "0f66b1ba-e9a9-46fd-b9d9-2e64fe94d307", "dataset_version": "c74b66cf37c0d4ed8914296c6d7792b2d25696aa"}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"dataset_id": "0f66b1ba-e9a9-46fd-b9d9-2e64fe94d307",
"dataset_version": "c74b66cf37c0d4ed8914296c6d7792b2d25696aa",
"type": "dataset",
"name": "conversion-qa",
"alias": "conversion-qa",
"children": [],
"url": [
"https://datapub.fz-juelich.de/studyforrest/studyforrest.ria/0f6/6b1ba-e9a9-46fd-b9d9-2e64fe94d307"
Expand Down Expand Up @@ -30,6 +32,14 @@
"source_time": 1652857127.245356,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "1882e2e6-fbbf-4ade-a65f-3a1615235f51", "dataset_version": "e5d2f8368fc5f6717d8ef131041c6d943298d0c7"}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,19 @@
"source_time": 1652857178.8397892,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
},
"name": "Studyforrest Structural MRI scans",
"alias": "3T_structural_mri",
"description": "\"This dataset contains T1 and T2 weighted MRI scans, susceptibility weighted\n images, and diffusion imaging scans. These data are suitable for analyses\n of brain structure.\n\n For more information about the project visit: http://studyforrest.org\"",
"license": {
"name": "Open Data Commons Public Domain Dedication and License (PDDL)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"dataset_id": "2d05f277-94b0-470b-8e11-4e56691d5b89",
"dataset_version": "78e04a00fedbe3e055f86c2f9127aa48e1133d55",
"type": "dataset",
"name": "retinotopic-maps",
"alias": "retinotopic-maps",
"children": [],
"url": [
"http://psydata.ovgu.de/studyforrest/retinotopy/.git",
Expand Down Expand Up @@ -39,6 +41,14 @@
"source_time": 1652857142.5423129,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "2d05f277-94b0-470b-8e11-4e56691d5b89", "dataset_version": "78e04a00fedbe3e055f86c2f9127aa48e1133d55"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "3304e775-5f5f-435a-b68e-d98c9f5fb72a", "dataset_version": "aaac44e047d375cd8f791b1b6fe2b739f02c83b2"}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"dataset_id": "3304e775-5f5f-435a-b68e-d98c9f5fb72a",
"dataset_version": "aaac44e047d375cd8f791b1b6fe2b739f02c83b2",
"type": "dataset",
"name": "cortical-surfaces-freesurfer",
"alias": "cortical-surfaces-freesurfer",
"children": [],
"url": [
"http://psydata.ovgu.de/studyforrest/visualrois/.git",
Expand Down Expand Up @@ -32,6 +34,14 @@
"source_time": 1652857136.363641,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "1882e2e6-fbbf-4ade-a65f-3a1615235f51", "dataset_version": "e5d2f8368fc5f6717d8ef131041c6d943298d0c7"}
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,19 @@
"source_time": 1652857221.792691,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
},
"name": "studyforrest_multires7t",
"alias": "7T_multiresolution_fmri",
"license": {
"name": "PDDL",
"url": ""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "3a8648b3-7df8-413f-8efb-4d39040ac174", "dataset_version": "10e23aafa8271f742e9022a3522d9a88d7fe30cf"}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"dataset_id": "45b9ab26-07fc-11e8-8c71-f0d5bf7b5561",
"dataset_version": "29dcce2b9477537b433996ebc342c531139e1d87",
"type": "dataset",
"name": "curated-annotations",
"alias": "curated-annotations",
"children": [],
"url": [
"https://datapub.fz-juelich.de/studyforrest/studyforrest.ria/45b/9ab26-07fc-11e8-8c71-f0d5bf7b5561"
Expand Down Expand Up @@ -34,6 +36,14 @@
"source_time": 1652857269.6786208,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "45b9ab26-07fc-11e8-8c71-f0d5bf7b5561", "dataset_version": "29dcce2b9477537b433996ebc342c531139e1d87"}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,19 @@
"source_time": 1652857174.37293,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
},
"name": "studyforrest_multires3t",
"alias": "studyforrest_multires3t",
"license": {
"name": "PDDL (http://opendatacommons.org/licenses/pddl/)",
"url": ""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "5b1081d6-84d7-11e8-b00a-a0369fb55db0", "dataset_version": "b623351b43eb2715331ac59ad4cf41682e84ff7d"}
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,19 @@
"source_time": 1652857264.862466,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
},
"name": "studyforrest_phase2",
"alias": "studyforrest_phase2",
"license": {
"name": "PDDL",
"url": ""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "5eaff716-54eb-11e8-803d-a0369f7c647e", "dataset_version": "72f835ada046bd0479009ea0ff933b30a95b0076"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "3a8648b3-7df8-413f-8efb-4d39040ac174", "dataset_version": "10e23aafa8271f742e9022a3522d9a88d7fe30cf"}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"dataset_id": "7fcd8812-d0fe-11e7-8db2-a0369f7c647e",
"dataset_version": "2ccaa115543c21e6658950d1cb8cc3038f14272f",
"type": "dataset",
"name": "aggregate",
"alias": "aggregate",
"children": [],
"url": [
"http://psydata.ovgu.de/studyforrest/aggregate/.git",
Expand Down Expand Up @@ -31,6 +33,14 @@
"source_time": 1652857130.159643,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "7fcd8812-d0fe-11e7-8db2-a0369f7c647e", "dataset_version": "2ccaa115543c21e6658950d1cb8cc3038f14272f"}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"dataset_id": "92e65958-4a5a-4c34-a4f4-ee070f7a123b",
"dataset_version": "203aa983534fc2b823ff4777a85f4f80d7a68656",
"type": "dataset",
"name": "visual-areas",
"alias": "visual-areas",
"children": [],
"url": [
"http://psydata.ovgu.de/studyforrest/visualrois/.git",
Expand Down Expand Up @@ -32,6 +34,14 @@
"source_time": 1652857147.619349,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "92e65958-4a5a-4c34-a4f4-ee070f7a123b", "dataset_version": "203aa983534fc2b823ff4777a85f4f80d7a68656"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "7fcd8812-d0fe-11e7-8db2-a0369f7c647e", "dataset_version": "2ccaa115543c21e6658950d1cb8cc3038f14272f"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "c8ec2919-493b-4af5-9271-cbe9ebd08c43", "dataset_version": "74cd7ec0538448b05fb4d5f91119b279c5e9ab04"}
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,19 @@
"source_time": 1702323824.737152,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
},
{
"source_name": "manual_entry",
"source_version": "1",
"source_parameter": {},
"source_time": 1709565468.450221,
"agent_name": "Stephan Heunis",
"agent_email": "s.heunis@fz-juelich.de"
}
]
},
"name": "Palmer Penguins",
"alias": "palmerpenguins",
"license": {
"name": "https://creativecommons.org/publicdomain/zero/1.0/",
"url": "https://creativecommons.org/publicdomain/zero/1.0/"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "redirect", "dataset_id": "c475969b-2919-57b1-a3e6-71770acaa222", "dataset_version": "0.1.0"}
Loading

0 comments on commit 53ac02a

Please sign in to comment.