Skip to content

Commit

Permalink
Show solution composition
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Mar 7, 2024
1 parent 47260eb commit a0f52b6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions apps/nar-v3/src/components/CellPatchingCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import Paper from "@mui/material/Paper";
import Connection from "./Connection";
import KeyValueTable from "./KeyValueTable";
import styles from "../styles";
import { formatQuant } from "../utility";
import { formatQuant, formatSolution } from "../utility";

function CellPatchingCard(props) {
const activity = props.activity;

const data = {
"Electrode description": activity.device[0].device.description,
"Pipette solution (more details to come)": activity.device[0].pipetteSolution.name,
"Pipette solution": formatSolution(activity.device[0].pipetteSolution.hasPart),
"Seal resistance": activity.device[0].sealResistance.value
.map((item) => formatQuant(item))
.join(", "),
Expand All @@ -40,7 +40,7 @@ function CellPatchingCard(props) {
"Holding potential": activity.device[0].holdingPotential.value
.map((item) => formatQuant(item))
.join(", "),
"Bath solution (more details to come)": activity.tissueBathSolution.name,
"Bath solution": formatSolution(activity.tissueBathSolution.hasPart),
"Bath temperature": formatQuant(activity.bathTemperature),
Description: activity.description,
Type: activity.variation,
Expand Down
4 changes: 0 additions & 4 deletions apps/nar-v3/src/components/DatasetCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ 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 @@ -89,8 +87,6 @@ function DatasetCard(props) {
const getPatchedCell = (subjectIndex, sliceIndex) => {
const cellPatching = getCellPatching(subjectIndex, sliceIndex);
if (cellPatching) {
console.log("patched cell:");
console.log(cellPatching.output[0]);
return cellPatching.output[0];
} else {
return null;
Expand Down
4 changes: 2 additions & 2 deletions apps/nar-v3/src/components/SlicePreparationCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
import Box from "@mui/material/Box";
import Paper from "@mui/material/Paper";

import { formatQuant } from "../utility";
import { formatQuant, formatSolution } from "../utility";
import Connection from "./Connection";
import KeyValueTable from "./KeyValueTable";
import styles from "../styles";
Expand All @@ -39,7 +39,7 @@ function SlicePreparationCard(props) {
"Slicing plane": activity.device[0].slicingPlane,
"Study targets": activity.studyTarget.join(", "),
Temperature: formatQuant(activity.temperature),
"Dissecting solution (full details to come)": activity.tissueBathSolution.name,
"Dissecting solution": formatSolution(activity.tissueBathSolution.hasPart),
};
return (
<>
Expand Down
10 changes: 10 additions & 0 deletions apps/nar-v3/src/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ function formatQuant(val) {
}
}

function formatSolution(components) {
const parts = [];
components.forEach((component) => {
const amount = formatQuant(component.amount);
const symbol = component.chemicalProduct ? component.chemicalProduct.name : "[missing]";
parts.push(`${amount} ${symbol}`)
})
return parts.join(", ");
}

function uuidFromUri(uri) {
const parts = uri.split("/");
return parts[parts.length - 1];
Expand Down

0 comments on commit a0f52b6

Please sign in to comment.