Notebook Block-Operationen
Erstellen und verwalten Sie Analyseblöcke innerhalb von Notebooks. Blöcke sind die Bausteine von Analyse-Workflows.
Blocktypen
| Typ | Beschreibung |
|---|---|
Filter |
Daten auf spezifische Fälle oder Ereignisse eingrenzen |
Calculator |
Metriken, Zeitdauern und abgeleitete Werte berechnen |
Opportunity |
Verbesserungsmöglichkeiten identifizieren |
Insight |
Visualisierungen und Statistiken erstellen |
Dashboard |
Teilbare Berichtsübersichten erstellen |
Alert |
Überwachungswarnungen definieren |
Blöcke auflisten
GET /api/{tenantId}/{projectId}/notebook/{notebookId}/blocks
Gibt alle Blöcke in einem Notebook in Ausführungsreihenfolge zurück.
Pfadparameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
tenantId |
GUID | Ja | Der Mandantenbezeichner |
projectId |
GUID | Ja | Der Projektbezeichner |
notebookId |
GUID | Ja | Der Notebook-Bezeichner |
Antwort (200 OK)
{
"notebookId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"blocks": [
{
"blockId": "11111111-1111-1111-1111-111111111111",
"blockType": "Filter",
"operatorName": "ActivityFilter",
"name": "Select Key Activities",
"description": "Filter to main process activities",
"parentId": null,
"order": 0,
"configuration": "{\"activities\": [\"Create Order\", \"Approve\", \"Ship\"]}",
"dateCreated": "2024-01-15T10:30:00Z",
"createdBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"dateModified": "2024-01-15T10:30:00Z",
"isActive": true
},
{
"blockId": "22222222-2222-2222-2222-222222222222",
"blockType": "Calculator",
"operatorName": "DurationCalculator",
"name": "Case Duration",
"description": "Calculate total case duration",
"parentId": "11111111-1111-1111-1111-111111111111",
"order": 0,
"configuration": "{\"unit\": \"days\"}",
"dateCreated": "2024-01-15T10:35:00Z",
"createdBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"dateModified": "2024-01-15T10:35:00Z",
"isActive": true
}
],
"totalCount": 2
}
Block-Felder
| Feld | Typ | Beschreibung |
|---|---|---|
blockId |
GUID | Einzigartige Block-ID |
blockType |
string | Typ (Filter, Calculator, etc.) |
operatorName |
string | Spezifischer Operatorname |
name |
string | Anzeigename des Blocks |
description |
string | Blockbeschreibung |
parentId |
GUID | Eltern-Block-ID (Datenfluss vom Elternteil) |
order |
integer | Ausführungsreihenfolge-Hinweis |
configuration |
string | JSON-Konfiguration für den Operator |
dateCreated |
datetime | Erstellungszeitpunkt |
createdBy |
GUID | Benutzer-ID des Erstellers |
dateModified |
datetime | Zeitpunkt der letzten Änderung |
isActive |
boolean | Ob der Block aktiviert ist |
Block erstellen
POST /api/{tenantId}/{projectId}/notebook/{notebookId}/blocks
Erstellt einen neuen Analyseblock im Notebook.
Pfadparameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
tenantId |
GUID | Ja | Der Mandantenbezeichner |
projectId |
GUID | Ja | Der Projektbezeichner |
notebookId |
GUID | Ja | Der Notebook-Bezeichner |
Anfragetext
{
"blockType": "Filter",
"operatorName": "ActivityFilter",
"name": "Filter by Status",
"description": "Keep only completed orders",
"configuration": "{\"activities\": [\"Complete\", \"Shipped\"]}",
"insertAfterBlockId": "11111111-1111-1111-1111-111111111111"
}
Anfragefelder
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
blockType |
string | Nein | Typ (Filter, Calculator, etc.) Standard: Filter |
operatorName |
string | Ja | Zu verwendender spezieller Operator |
name |
string | Ja | Anzeigename des Blocks |
description |
string | Nein | Blockbeschreibung |
configuration |
string | Nein | JSON-Konfiguration für den Operator |
insertAfterBlockId |
GUID | Nein | Einfügen nach diesem Block (Standard: Ende) |
Antwort (201 Created)
{
"blockId": "33333333-3333-3333-3333-333333333333",
"blockType": "Filter",
"operatorName": "ActivityFilter",
"name": "Filter by Status",
"description": "Keep only completed orders",
"parentId": "11111111-1111-1111-1111-111111111111",
"order": 0,
"configuration": "{\"activities\": [\"Complete\", \"Shipped\"]}",
"dateCreated": "2024-03-01T10:00:00Z",
"createdBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"dateModified": "2024-03-01T10:00:00Z",
"isActive": true
}
Block-Reihenfolge abrufen
GET /api/{tenantId}/{projectId}/notebook/{notebookId}/blocks/order
Gibt die aktuelle Ausführungsreihenfolge der Blöcke zurück.
Antwort (200 OK)
{
"notebookId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"blockCount": 3,
"blockOrder": [
{
"blockId": "11111111-1111-1111-1111-111111111111",
"parentId": null,
"position": 1
},
{
"blockId": "22222222-2222-2222-2222-222222222222",
"parentId": "11111111-1111-1111-1111-111111111111",
"position": 2
},
{
"blockId": "33333333-3333-3333-3333-333333333333",
"parentId": "22222222-2222-2222-2222-222222222222",
"position": 3
}
]
}
Blöcke neu anordnen
PUT /api/{tenantId}/{projectId}/notebook/{notebookId}/blocks/order
Ändert die Ausführungsreihenfolge der Blöcke im Notebook.
Anfragetext
{
"blockIds": [
"11111111-1111-1111-1111-111111111111",
"33333333-3333-3333-3333-333333333333",
"22222222-2222-2222-2222-222222222222"
]
}
Anfragefelder
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
blockIds |
array | Ja | Block-IDs in gewünschter Ausführungsreihenfolge |
Antwort (200 OK)
Gibt die aktualisierte Blockreihenfolge zurück.
Block-Ausführungsfluss
Blöcke bilden eine Kette, wobei jeder Block Daten von seinem Elternteil erhält:
[Investigation Start]
|
v
[Filter: Activity Filter] -> Filtert auf spezifische Aktivitäten
|
v
[Calculator: Duration] -> Berechnet Zeitdauern für gefilterte Daten
|
v
[Insight: Statistics] -> Erstellt Statistiken zu berechneten Daten
Wenn Sie Blöcke neu anordnen, wird die Eltern-Kette automatisch aktualisiert.
Implementierungsbeispiele
Python
import requests
import json
BASE_URL = 'https://your-mindzie-instance.com'
TENANT_ID = '12345678-1234-1234-1234-123456789012'
PROJECT_ID = '87654321-4321-4321-4321-210987654321'
class BlockManager:
def __init__(self, api_key):
self.headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
def list_blocks(self, notebook_id):
"""Listet alle Blöcke in einem Notebook auf."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/{notebook_id}/blocks'
response = requests.get(url, headers=self.headers)
response.raise_for_status()
return response.json()
def create_block(self, notebook_id, block_type, operator_name, name,
description=None, configuration=None, insert_after=None):
"""Erstellt einen neuen Block."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/{notebook_id}/blocks'
data = {
'blockType': block_type,
'operatorName': operator_name,
'name': name,
'description': description,
'configuration': json.dumps(configuration) if configuration else None,
'insertAfterBlockId': insert_after
}
response = requests.post(url, json=data, headers=self.headers)
response.raise_for_status()
return response.json()
def get_block_order(self, notebook_id):
"""Holt die aktuelle Ausführungsreihenfolge der Blöcke."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/{notebook_id}/blocks/order'
response = requests.get(url, headers=self.headers)
response.raise_for_status()
return response.json()
def reorder_blocks(self, notebook_id, block_ids):
"""Ordnet Blöcke im Notebook neu an."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/{notebook_id}/blocks/order'
response = requests.put(url, json={'blockIds': block_ids}, headers=self.headers)
response.raise_for_status()
return response.json()
# Nutzung
manager = BlockManager('your-api-key')
notebook_id = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'
# Blöcke auflisten
blocks = manager.list_blocks(notebook_id)
print(f"Gefundene Blöcke: {blocks['totalCount']}")
# Einen Filter-Block erstellen
filter_block = manager.create_block(
notebook_id,
block_type='Filter',
operator_name='ActivityFilter',
name='Select Key Activities',
configuration={'activities': ['Create Order', 'Approve', 'Ship']}
)
print(f"Filter erstellt: {filter_block['blockId']}")
# Einen Calculator-Block nach dem Filter erstellen
calc_block = manager.create_block(
notebook_id,
block_type='Calculator',
operator_name='DurationCalculator',
name='Case Duration',
configuration={'unit': 'days'},
insert_after=filter_block['blockId']
)
print(f"Calculator erstellt: {calc_block['blockId']}")
# Ausführungsreihenfolge prüfen
order = manager.get_block_order(notebook_id)
print(f"Blockreihenfolge: {[b['blockId'] for b in order['blockOrder']]}")
JavaScript/Node.js
const BASE_URL = 'https://your-mindzie-instance.com';
const TENANT_ID = '12345678-1234-1234-1234-123456789012';
const PROJECT_ID = '87654321-4321-4321-4321-210987654321';
class BlockManager {
constructor(apiKey) {
this.headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
};
}
async listBlocks(notebookId) {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/notebook/${notebookId}/blocks`;
const response = await fetch(url, { headers: this.headers });
if (!response.ok) throw new Error(`Fehler: ${response.status}`);
return response.json();
}
async createBlock(notebookId, blockType, operatorName, name, options = {}) {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/notebook/${notebookId}/blocks`;
const body = {
blockType,
operatorName,
name,
description: options.description,
configuration: options.configuration ? JSON.stringify(options.configuration) : null,
insertAfterBlockId: options.insertAfter
};
const response = await fetch(url, {
method: 'POST',
headers: this.headers,
body: JSON.stringify(body)
});
if (!response.ok) throw new Error(`Fehler: ${response.status}`);
return response.json();
}
async reorderBlocks(notebookId, blockIds) {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/notebook/${notebookId}/blocks/order`;
const response = await fetch(url, {
method: 'PUT',
headers: this.headers,
body: JSON.stringify({ blockIds })
});
if (!response.ok) throw new Error(`Fehler: ${response.status}`);
return response.json();
}
}
// Nutzung
const manager = new BlockManager('your-api-key');
const notebookId = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee';
// Blöcke auflisten
const blocks = await manager.listBlocks(notebookId);
console.log(`Gefundene Blöcke: ${blocks.totalCount}`);
// Blöcke erstellen
const filter = await manager.createBlock(notebookId, 'Filter', 'ActivityFilter', 'Key Activities', {
configuration: { activities: ['Create', 'Approve'] }
});
const calc = await manager.createBlock(notebookId, 'Calculator', 'DurationCalculator', 'Duration', {
insertAfter: filter.blockId
});
Best Practices
- Blockreihenfolge ist entscheidend: Daten fließen vom Eltern- zum Kindblock – planen Sie Ihren Workflow
- Vorlagen verwenden: Für komplexe Workflows von Vorlagen erstellen
- Konfigurations-JSON: Operator-spezifische Einstellungen als JSON-Strings speichern
- InsertAfter:
insertAfterBlockIdverwenden, um die Positionierung zu steuern - Ausführung: Nach dem Erstellen der Blöcke das Notebook ausführen, um Ergebnisse zu sehen