Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Mar 5, 2024
1 parent 5fef844 commit 4eacbc1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apps/nar-v3/src/components/DatasetCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function SubjectCard(props) {
<dd>{subject.studiedState[0].ageCategory}</dd>
<dt>Pathologies</dt>
<dd>
{subject.studiedState[0].pathology
{subject.studiedState[0].pathology.length > 0
? subject.studiedState[0].pathology[0].name
: "none"}
</dd>
Expand Down
11 changes: 6 additions & 5 deletions apps/nar-v3/src/datastore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { kgUrl } from "./globals";
import { kgUrl, kgDefaultStage } from "./globals";
import { buildKGQuery, simpleProperty as S, linkProperty as L, reverseLinkProperty as R } from "./queries";
import { uuidFromUri } from "./utility.js";
import examplePatchClampData from "./example_data/example_patch_clamp_dataset.json";
Expand Down Expand Up @@ -31,7 +31,8 @@ class DataStore {
"patch clamp recordings summary": {},
"patch clamp recordings detail": {}
};
this.cache["datasets detail"][uuidFromUri(examplePatchClampData["@id"])] = examplePatchClampData;
//this.cache["datasets detail"][uuidFromUri(examplePatchClampData["@id"])] = examplePatchClampData;
this.cache["datasets detail"]["example"] = examplePatchClampData;
}

buildRequestConfig(method="GET", body={}) {
Expand All @@ -58,7 +59,7 @@ class DataStore {
return result;
}

async getKGItem(cacheLabel, kgQuery, instanceId, stage = "RELEASED") {
async getKGItem(cacheLabel, kgQuery, instanceId, stage = kgDefaultStage) {
console.log("getKGItem " + cacheLabel + instanceId);
if (!this.cache[cacheLabel][instanceId]) {
const searchParams = {stage: stage, instanceId: instanceId};
Expand All @@ -69,7 +70,7 @@ class DataStore {
return this.cache[cacheLabel][instanceId];
}

async getKGData(cacheLabel, kgQuery, searchFilters, stage = "RELEASED", size = 1000, from = 0) {
async getKGData(cacheLabel, kgQuery, searchFilters, stage = kgDefaultStage, size = 1000, from = 0) {
console.log("getKGData " + cacheLabel);
if (isEmpty(this.cache[cacheLabel])) {
// if the cache is empty we need to fill it
Expand All @@ -94,7 +95,7 @@ class DataStore {
return itemArray
}

async count(kgQuery, searchFilters, stage = "RELEASED") {
async count(kgQuery, searchFilters, stage = kgDefaultStage) {
let searchParams = {
returnTotalResults: true,
stage: stage,
Expand Down
1 change: 1 addition & 0 deletions apps/nar-v3/src/globals.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const kgUrl = "https://core.kg.ebrains.eu/v3";
export const kgDefaultStage = "IN_PROGRESS";
45 changes: 33 additions & 12 deletions apps/nar-v3/src/routes/dataset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const actorQuery = [
S("givenName"),
S("familyName"),
S("fullName"),
S("shortName")
]
S("shortName"),
];

const MULTIPLE = { expectSingle: false };

const query = buildKGQuery("core/DatasetVersion", [
S("@id"),
Expand All @@ -31,23 +33,20 @@ const query = buildKGQuery("core/DatasetVersion", [
L("ethicsAssessment/name"),
L("license/shortName"),
S("releaseDate"),
L("custodian", actorQuery, { expectSingle: false }),
L("author", actorQuery, { expectSingle: false }),
L("custodian", actorQuery, MULTIPLE),
L("author", actorQuery, MULTIPLE),
R("isVersionOf", "hasVersion", [
S("fullName"),
S("description"),
S("shortName"),
L("custodian", actorQuery, { expectSingle: false }),
L("author", actorQuery, { expectSingle: false }),
L("custodian", actorQuery, MULTIPLE),
L("author", actorQuery, MULTIPLE),
]),
L(
"studiedSpecimen",
[
S("lookupLabel"),
L("species", [
S("name"),
L("species/name")
]),
L("species", [S("name"), L("species/name")]),
L("biologicalSex/name"),
L(
"studiedState",
Expand All @@ -62,9 +61,31 @@ const query = buildKGQuery("core/DatasetVersion", [
L("maxValueUnit/name"),
]),
L("ageCategory/name"),
L("pathology", [], { expectSingle: false }),
L("pathology", [S("name")], MULTIPLE),
R(
"slicePreparation",
"input",
[
// slice preparation
S("lookupLabel"),
S("@type"),
L("device", []),
L("studyTarget/name", [], MULTIPLE),
L("temperature", [S("name"), L("unit/name")]),
L("tissueBathSolution", [S("name"), L("hasPart", [], MULTIPLE)]),
L(
"output",
[
// slices
S("lookupLabel"),
],
MULTIPLE
),
],
MULTIPLE
),
],
{ expectSingle: false }
MULTIPLE
),
],
{ type: "core/Subject", expectSingle: false }
Expand Down

0 comments on commit 4eacbc1

Please sign in to comment.