Skip to content

Commit e4212cf

Browse files
DOC-6026 improved decision tree
1 parent 1517b3c commit e4212cf

File tree

3 files changed

+129
-7
lines changed

3 files changed

+129
-7
lines changed

content/integrate/redis-data-integration/when-to-use.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ questions:
7070
outcome:
7171
label: "RDI is not necessary for your use case"
7272
id: notNecessary
73+
sentiment: "negative"
7374
writeLocation:
7475
text: |
7576
Does your app write data directly to the disk-based database?
@@ -84,6 +85,7 @@ questions:
8485
outcome:
8586
label: "RDI won't work - your app must write to the primary database"
8687
id: wrongWritePattern
88+
sentiment: "negative"
8789
consistency:
8890
text: |
8991
Can your app tolerate eventual consistency in the Redis cache?
@@ -98,6 +100,7 @@ questions:
98100
outcome:
99101
label: "RDI is not suitable - you need immediate cache consistency"
100102
id: needsImmediate
103+
sentiment: "negative"
101104
throughput:
102105
text: |
103106
Will your throughput stay within RDI limits (≤30K records/sec during full sync, ≤10K records/sec during CDC)?
@@ -112,6 +115,7 @@ questions:
112115
outcome:
113116
label: "RDI throughput limits will be exceeded"
114117
id: exceedsLimits
118+
sentiment: "negative"
115119
dataPattern:
116120
text: |
117121
Is your data updated frequently in small increments (not by batch/ETL with large transactions)?
@@ -126,6 +130,7 @@ questions:
126130
outcome:
127131
label: "RDI will fail with batch/ETL processes and large transactions"
128132
id: batchProcessing
133+
sentiment: "negative"
129134
dataSize:
130135
text: |
131136
Is your data set large enough to benefit from caching?
@@ -140,6 +145,7 @@ questions:
140145
outcome:
141146
label: "RDI is not necessary - your data set is too small"
142147
id: tooSmall
148+
sentiment: "negative"
143149
dataSource:
144150
text: |
145151
Is your data ingested from a single source (not from two Active-Active replicas simultaneously)?
@@ -151,11 +157,13 @@ questions:
151157
outcome:
152158
label: "✅ RDI is a good fit for your use case"
153159
id: goodFit
160+
sentiment: "positive"
154161
no:
155162
value: "No"
156163
outcome:
157164
label: "RDI won't work with Active-Active replicas"
158165
id: activeActive
166+
sentiment: "negative"
159167
```
160168

161169

static/js/decision-tree.js

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
depth: depth + 1,
9696
type: 'outcome',
9797
text: question.answers.yes.outcome.label || '',
98-
answer: 'Yes'
98+
answer: 'Yes',
99+
sentiment: question.answers.yes.outcome.sentiment || null
99100
});
100101
}
101102
}
@@ -110,7 +111,8 @@
110111
depth: depth + 1,
111112
type: 'outcome',
112113
text: question.answers.no.outcome.label || '',
113-
answer: 'No'
114+
answer: 'No',
115+
sentiment: question.answers.no.outcome.sentiment || null
114116
});
115117
}
116118
}
@@ -204,11 +206,26 @@
204206
rect.setAttribute('height', item.boxHeight);
205207

206208
if (item.type === 'outcome') {
207-
// Outcomes: pale red background, dashed border
208-
rect.setAttribute('fill', '#ffe6e6');
209-
rect.setAttribute('stroke', '#d9534f');
210-
rect.setAttribute('stroke-width', '1');
211-
rect.setAttribute('stroke-dasharray', '3,3');
209+
// Outcomes: color based on sentiment
210+
if (item.sentiment === 'positive') {
211+
// Green for positive outcomes
212+
rect.setAttribute('fill', '#e6f7f0');
213+
rect.setAttribute('stroke', '#0fa869');
214+
rect.setAttribute('stroke-width', '1');
215+
rect.setAttribute('stroke-dasharray', '3,3');
216+
} else if (item.sentiment === 'negative') {
217+
// Red for negative outcomes
218+
rect.setAttribute('fill', '#ffe6e6');
219+
rect.setAttribute('stroke', '#d9534f');
220+
rect.setAttribute('stroke-width', '1');
221+
rect.setAttribute('stroke-dasharray', '3,3');
222+
} else {
223+
// Default red for outcomes without explicit sentiment
224+
rect.setAttribute('fill', '#ffe6e6');
225+
rect.setAttribute('stroke', '#d9534f');
226+
rect.setAttribute('stroke-width', '1');
227+
rect.setAttribute('stroke-dasharray', '3,3');
228+
}
212229
} else {
213230
// Questions: standard styling
214231
rect.setAttribute('fill', '#f5f5f5');

static/schemas/decision-tree.json

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://redis.io/schemas/decision-tree.json",
4+
"title": "Redis Decision Tree Metadata",
5+
"description": "Schema for decision tree metadata in Redis documentation",
6+
"type": "object",
7+
"required": ["type", "id", "scope"],
8+
"properties": {
9+
"$schema": {
10+
"type": "string",
11+
"description": "Reference to this schema"
12+
},
13+
"type": {
14+
"type": "string",
15+
"enum": ["decision-tree"],
16+
"description": "The metadata type"
17+
},
18+
"id": {
19+
"type": "string",
20+
"description": "Unique identifier for the decision tree"
21+
},
22+
"scope": {
23+
"type": "string",
24+
"description": "Category or domain this tree applies to (e.g., 'documents', 'collections', 'rdi')"
25+
},
26+
"rootQuestion": {
27+
"type": "string",
28+
"description": "ID of the starting question"
29+
},
30+
"questions": {
31+
"type": "object",
32+
"description": "Object containing all questions, keyed by ID",
33+
"additionalProperties": {
34+
"type": "object",
35+
"required": ["text", "whyAsk", "answers"],
36+
"properties": {
37+
"text": {
38+
"type": "string",
39+
"description": "The question text"
40+
},
41+
"whyAsk": {
42+
"type": "string",
43+
"description": "Explanation of why this question matters"
44+
},
45+
"answers": {
46+
"type": "object",
47+
"required": ["yes", "no"],
48+
"properties": {
49+
"yes": {
50+
"$ref": "#/definitions/answer"
51+
},
52+
"no": {
53+
"$ref": "#/definitions/answer"
54+
}
55+
}
56+
}
57+
}
58+
}
59+
}
60+
},
61+
"definitions": {
62+
"answer": {
63+
"type": "object",
64+
"required": ["value"],
65+
"properties": {
66+
"value": {
67+
"type": "string",
68+
"description": "Display text (e.g., 'Yes' or 'No')"
69+
},
70+
"outcome": {
71+
"type": "object",
72+
"required": ["label", "id"],
73+
"properties": {
74+
"label": {
75+
"type": "string",
76+
"description": "The recommendation text"
77+
},
78+
"id": {
79+
"type": "string",
80+
"description": "Unique identifier for this outcome"
81+
},
82+
"sentiment": {
83+
"type": "string",
84+
"enum": ["positive", "negative"],
85+
"description": "Sentiment of the outcome for visual styling (positive=green, negative=red)"
86+
}
87+
}
88+
},
89+
"nextQuestion": {
90+
"type": "string",
91+
"description": "ID of the next question to ask"
92+
}
93+
}
94+
}
95+
}
96+
}
97+

0 commit comments

Comments
 (0)