Skip to content

Commit fb61b30

Browse files
authored
Merge pull request #9 from noworneverev/bug/covariate
Fix rendering result graph bug
2 parents 558dc98 + 24c388b commit fb61b30

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

src/app/components/DetailDrawer.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ const DetailDrawer: React.FC<DetailDrawerProps> = ({
177177
</Typography>
178178
<Typography>ID: {selectedNode.uuid}</Typography>
179179
<Typography>Name: {selectedNode.name}</Typography>
180+
{selectedNode.covariate_type && (
181+
<Typography>
182+
Covariate Type: {selectedNode.covariate_type}
183+
</Typography>
184+
)}
180185
<Typography>Type: {selectedNode.type}</Typography>
181186
{selectedNode.title && (
182187
<Typography>Title: {selectedNode.title}</Typography>
@@ -193,6 +198,11 @@ const DetailDrawer: React.FC<DetailDrawerProps> = ({
193198
{selectedNode.description && (
194199
<Typography>Description: {selectedNode.description}</Typography>
195200
)}
201+
{selectedNode.human_readable_id && (
202+
<Typography>
203+
Human Readable ID: {selectedNode.human_readable_id}
204+
</Typography>
205+
)}
196206

197207
{/* {selectedNode.human_readable_id ||
198208
(selectedNode.human_readable_id === 0 && (

src/app/components/GraphViewer.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
184184
} else if (key === "entities") {
185185
const existingNode = baseGraphData.nodes.find(
186186
(node) =>
187-
node.human_readable_id?.toString() === item.id.toString()
187+
node.human_readable_id?.toString() === item.id.toString() &&
188+
!node.covariate_type
188189
);
189190
if (existingNode) {
190191
newNodes.push(existingNode);
@@ -206,7 +207,8 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
206207
} else if (key === "covariates" || key === "claims") {
207208
const existingNode = baseGraphData.nodes.find(
208209
(node) =>
209-
node.human_readable_id?.toString() === item.id.toString()
210+
node.human_readable_id?.toString() === item.id.toString() &&
211+
node.covariate_type
210212
);
211213
if (existingNode) {
212214
newNodes.push(existingNode);

src/app/hooks/useGraphData.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ const useGraphData = (
227227
human_readable_id: covariate.human_readable_id,
228228
name: `COVARIATE ${covariate.id}`,
229229
covariate_type: covariate.covariate_type,
230-
type: "COVARIATE",
230+
// type: "COVARIATE",
231+
type: covariate.type,
231232
description: covariate.description || "",
232233
subject_id: covariate.subject_id,
233234
subject_type: covariate.subject_type,

src/app/models/custom-graph-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export interface CustomNode extends NodeObject {
4040
end_date?: string;
4141
source_text?: string;
4242
text_unit_id?: string;
43-
43+
covariate_type?: string;
4444
}
4545

4646
export interface CustomLink extends LinkObject {

0 commit comments

Comments
 (0)