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 9980ee4
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 39 deletions.
28 changes: 14 additions & 14 deletions 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 Expand Up @@ -161,15 +161,15 @@ function SlicePreparationCard(props) {
<p>{activity.label}</p>
<dl>
<dt>Device name</dt>
<dd>{activity.deviceUsage[0].device.name}</dd>
<dd>{activity.device[0].device.name}</dd>
<dt>Device type</dt>
<dd>{activity.deviceUsage[0].device.deviceType.name}</dd>
<dd>{activity.device[0].device.deviceType.name}</dd>
<dt>Manufacturer</dt>
<dd>{activity.deviceUsage[0].device.manufacturer.fullName}</dd>
<dd>{activity.device[0].device.manufacturer.fullName}</dd>
<dt>Slice thickness</dt>
<dd>{formatQuant(activity.deviceUsage[0].sliceThickness)}</dd>
<dd>{formatQuant(activity.device[0].sliceThickness)}</dd>
<dt>Slicing plane</dt>
<dd>{activity.deviceUsage[0].slicingPlane.name}</dd>
<dd>{activity.device[0].slicingPlane.name}</dd>
<dt>Study targets</dt>
<dd>{activity.studyTargets.map((item) => item.name).join(", ")}</dd>
<dt>Temperature</dt>
Expand Down Expand Up @@ -243,26 +243,26 @@ function CellPatchingCard(props) {

<dl>
<dt>Electrode description</dt>
<dd>{activity.deviceUsage[0].device.description}</dd>
{/* activity.deviceUsage[0].device.deviceType.name */}
{/* activity.deviceUsage[0].device.manufacturer.fullName */}
<dd>{activity.device[0].device.description}</dd>
{/* activity.device[0].device.deviceType.name */}
{/* activity.device[0].device.manufacturer.fullName */}
<dt>Pipette solution (more details to come)</dt>
<dd>{activity.deviceUsage[0].pipetteSolution.name}</dd>
<dd>{activity.device[0].pipetteSolution.name}</dd>
<dt>Seal resistance</dt>
<dd>
{activity.deviceUsage[0].sealResistance.values
{activity.device[0].sealResistance.values
.map((item) => formatQuant(item))
.join(", ")}
</dd>
<dt>Series resistance</dt>
<dd>
{activity.deviceUsage[0].seriesResistance.values
{activity.device[0].seriesResistance.values
.map((item) => formatQuant(item))
.join(", ")}
</dd>
<dt>Holding potential</dt>
<dd>
{activity.deviceUsage[0].holdingPotential.values
{activity.device[0].holdingPotential.values
.map((item) => formatQuant(item))
.join(", ")}
</dd>
Expand Down Expand Up @@ -444,7 +444,7 @@ function DatasetCard(props) {
const getSlices = (subjectIndex) => {
const slicePrep = getSlicePreparation(subjectIndex);
if (slicePrep) {
return slicePrep.slices;
return slicePrep.output;
} else {
return null;
}
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";
195 changes: 175 additions & 20 deletions apps/nar-v3/src/routes/dataset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,40 @@ import Navigation from "../components/Navigation";
import DatasetCard from "../components/DatasetCard";
import ProgressIndicator from "../components/ProgressIndicator";

const MULTIPLE = { expectSingle: false };

const actorQuery = [
S("@id"),
S("@type"),
S("givenName"),
S("familyName"),
S("fullName"),
S("shortName")
]
S("shortName"),
];

const quantValQuery = [
S("value"),
S("minValue"),
S("maxValue"),
L("unit/name"),
L("minValueUnit/name"),
L("maxValueUnit/name"),
];

const solutionQuery = [
S("name"),
L("hasPart", [S("amount"), L("chemicalProduct/name")], MULTIPLE),
];

const deviceQuery = L("device", [
S("lookupLabel"),
S("name"),
S("@type"),
S("internalIdentifier"),
S("description"),
L("deviceType/name"),
L("manufacturer", [S("shortName", S("longName"))]),
]);

const query = buildKGQuery("core/DatasetVersion", [
S("@id"),
Expand All @@ -31,40 +57,169 @@ 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",
[
S("lookupLabel"),
L("age", [
S("value"),
S("minValue"),
S("maxValue"),
L("unit/name"),
L("minValueUnit/name"),
L("maxValueUnit/name"),
]),
L("age", quantValQuery),
L("ageCategory/name"),
L("pathology", [], { expectSingle: false }),
L("pathology", [S("name")], MULTIPLE),
R(
"slicePreparation",
"input",
[
// slice preparation
S("lookupLabel"),
S("@type"),
L(
"device",
[
// device usage
S("lookupLabel"),
deviceQuery,
L("sliceThickness", quantValQuery),
L("slicingPlane/name"),
],
MULTIPLE
),
L("studyTarget/name", [], MULTIPLE),
L("temperature", [S("name"), L("unit/name")]),
L("tissueBathSolution", solutionQuery),
L(
"output",
[
// slices
S("lookupLabel"),
S("internalIdentifier"),
R("slice", "studiedState", [
S("lookupLabel"),
S("@type"),
S("internalIdentifier"),
L("anatomicalLocation", [S("name"), S("@type")]),
L("type/name"),
]),
R("cellPatching", "input", [
S("lookupLabel"),
S("@type"),
L("device", [
// device usage
S("lookupLabel"),
deviceQuery,
L("pipetteSolution", solutionQuery),
L("sealResistance", [
L("values", quantValQuery, MULTIPLE),
]),
L("seriesResistance", [
L("values", quantValQuery, MULTIPLE),
]),
L("holdingPotential", [
L("values", quantValQuery, MULTIPLE),
]),
]),
L("tissueBathSolution", solutionQuery),
L("bathTemperature", quantValQuery),
S("description"),
L("variation/name"),
L("output", [
// patched cells
S("lookupLabel"),
S("@type"),
R("cell", "studiedState", [
S("internalIdentifier"),
L("type/name"),
L("anatomicalLocation/name", [], MULTIPLE),
]),
R(
"recordingActivity",
"input",
[
S("lookupLabel"),
S("@type"),
S("description"),
S("internalIdentifier"),
L("device", [
R("metadata", "recordedWith", [
S("name"),
S("additionalRemarks"),
L("samplingFrequency", quantValQuery),
L(
"channel",
[S("internalIdentifier"), L("unit/name")],
MULTIPLE
),
]),
]),
L(
"output",
[
S("@id"),
S("name"),
S("IRI"),
S("dataType/name"),
S("format/name"),
L(
"hash",
[S("algorithm"), S("digest")],
MULTIPLE
),
L("storageSize", [S("value"), L("unit/name")]),
],
MULTIPLE
),
],
{ type: "ephys/RecordingActivity", expectSingle: false }
),
R(
"stimulationActivity",
"input",
[
S("lookupLabel"),
S("@type"),
L(
"stimulus",
[
S("lookupLabel"),
S("@type"),
L("epoch", quantValQuery),
S("internalIdentifier"),
L("specification", [
S("lookupLabel"),
S("configuration"),
]),
],
MULTIPLE
),
],
{
type: "stimulation/StimulationActivity",
expectSingle: false,
}
),
]),
]),
],
MULTIPLE
),
],
MULTIPLE
),
],
{ expectSingle: false }
MULTIPLE
),
],
{ type: "core/Subject", expectSingle: false }
Expand Down

0 comments on commit 9980ee4

Please sign in to comment.