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 24c7fb6
Show file tree
Hide file tree
Showing 4 changed files with 225 additions and 45 deletions.
51 changes: 31 additions & 20 deletions apps/nar-v3/src/components/DatasetCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from "@mui/material/Button";
import Paper from "@mui/material/Paper";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import Markdown from 'react-markdown'
import Markdown from "react-markdown";

import { uuidFromUri } from "../utility.js";

Expand Down 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,17 +161,20 @@ 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}</dd>
<dt>Manufacturer</dt>
<dd>{activity.deviceUsage[0].device.manufacturer.fullName}</dd>
<dd>
{activity.device[0].device.manufacturer.fullName ||
activity.device[0].device.manufacturer.shortName}
</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}</dd>
<dt>Study targets</dt>
<dd>{activity.studyTargets.map((item) => item.name).join(", ")}</dd>
<dd>{activity.studyTarget.join(", ")}</dd>
<dt>Temperature</dt>
<dd>{formatQuant(activity.temperature)}</dd>
<dt>Dissecting solution (full details to come)</dt>
Expand Down Expand Up @@ -243,26 +246,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.value
.map((item) => formatQuant(item))
.join(", ")}
</dd>
<dt>Series resistance</dt>
<dd>
{activity.deviceUsage[0].seriesResistance.values
{activity.device[0].seriesResistance.value
.map((item) => formatQuant(item))
.join(", ")}
</dd>
<dt>Holding potential</dt>
<dd>
{activity.deviceUsage[0].holdingPotential.values
{activity.device[0].holdingPotential.value
.map((item) => formatQuant(item))
.join(", ")}
</dd>
Expand All @@ -274,7 +277,7 @@ function CellPatchingCard(props) {
<dt>Description</dt>
<dd>{activity.description}</dd>
<dt>Type</dt>
<dd>{activity.variation.name}</dd>
<dd>{activity.variation}</dd>
</dl>
</Box>
</>
Expand Down Expand Up @@ -444,7 +447,7 @@ function DatasetCard(props) {
const getSlices = (subjectIndex) => {
const slicePrep = getSlicePreparation(subjectIndex);
if (slicePrep) {
return slicePrep.slices;
return slicePrep.output;
} else {
return null;
}
Expand All @@ -454,6 +457,8 @@ function DatasetCard(props) {
const slices = getSlices(subjectIndex);
if (slices) {
const slice = slices[sliceIndex];
console.log("cell patching:");
console.log(slice.cellPatching[0]);
return slice.cellPatching[0];
} else {
return null;
Expand All @@ -463,7 +468,9 @@ function DatasetCard(props) {
const getPatchedCell = (subjectIndex, sliceIndex) => {
const cellPatching = getCellPatching(subjectIndex, sliceIndex);
if (cellPatching) {
return cellPatching.patchedCells[0];
console.log("patched cell:");
console.log(cellPatching.output[0]);
return cellPatching.output[0];
} else {
return null;
}
Expand Down Expand Up @@ -520,7 +527,9 @@ function DatasetCard(props) {
View in KG Search
</Button>
</h1>
<Typography variant="h6" gutterBottom>{formatAuthors(dataset)}</Typography>
<Typography variant="h6" gutterBottom>
{formatAuthors(dataset)}
</Typography>
<Stack direction="row" spacing={2} alignItems="center">
<div>
<b>Licence: </b>
Expand All @@ -539,7 +548,9 @@ function DatasetCard(props) {
{dataset.releaseDate}
</div>
</Stack>
<Markdown>{dataset.description || dataset.isVersionOf.description}</Markdown>
<Markdown>
{dataset.description || dataset.isVersionOf.description}
</Markdown>

{subjects ? (
<Stack
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";
Loading

0 comments on commit 24c7fb6

Please sign in to comment.