Defter Blok İşlemleri

Defterlerde analiz blokları oluşturun ve yönetin. Bloklar, analiz iş akışlarının yapı taşlarıdır.


Blok Türleri

Tür Açıklama
Filter Veriyi belirli vaka veya olaylara daraltır
Calculator Metrik, süre ve türetilmiş değerleri hesaplar
Opportunity İyileştirme fırsatlarını belirler
Insight Görselleştirmeler ve istatistikler oluşturur
Dashboard Paylaşılabilir rapor panelleri yaratır
Alert İzleme uyarıları tanımlar

Blokları Listele

GET /api/{tenantId}/{projectId}/notebook/{notebookId}/blocks

Bir defterdeki tüm blokları yürütme sırasına göre döner.

Yol Parametreleri

Parametre Tür Zorunlu Açıklama
tenantId GUID Evet Kiracı kimliği
projectId GUID Evet Proje kimliği
notebookId GUID Evet Defter kimliği

Yanıt (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
}

Blok Alanları

Alan Tür Açıklama
blockId GUID Benzersiz blok kimliği
blockType string Tür (Filter, Calculator vb.)
operatorName string Özel operatör adı
name string Blok gösterim adı
description string Blok açıklaması
parentId GUID Ebeveyn blok kimliği (veri ebeveynden gelir)
order integer Yürütme sırası ipucu
configuration string Operatör için JSON yapılandırması
dateCreated datetime Oluşturulma zaman damgası
createdBy GUID Oluşturan kullanıcı kimliği
dateModified datetime Son değiştirilme zaman damgası
isActive boolean Blok etkin mi

Blok Oluştur

POST /api/{tenantId}/{projectId}/notebook/{notebookId}/blocks

Deftere yeni bir analiz bloğu oluşturur.

Yol Parametreleri

Parametre Tür Zorunlu Açıklama
tenantId GUID Evet Kiracı kimliği
projectId GUID Evet Proje kimliği
notebookId GUID Evet Defter kimliği

İstek Gövdesi

{
  "blockType": "Filter",
  "operatorName": "ActivityFilter",
  "name": "Filter by Status",
  "description": "Keep only completed orders",
  "configuration": "{\"activities\": [\"Complete\", \"Shipped\"]}",
  "insertAfterBlockId": "11111111-1111-1111-1111-111111111111"
}

İstek Alanları

Alan Tür Zorunlu Açıklama
blockType string Hayır Tür (Filter, Calculator vb.) Varsayılan: Filter
operatorName string Evet Kullanılacak özel operatör
name string Evet Blok gösterim adı
description string Hayır Blok açıklaması
configuration string Hayır Operatör için JSON yapılandırması
insertAfterBlockId GUID Hayır Bu bloktan sonra ekle (varsayılan: son)

Yanıt (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
}

Blok Sırasını Al

GET /api/{tenantId}/{projectId}/notebook/{notebookId}/blocks/order

Blokların mevcut yürütme sırasını döner.

Yanıt (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
    }
  ]
}

Blokları Yeniden Sırala

PUT /api/{tenantId}/{projectId}/notebook/{notebookId}/blocks/order

Defterdeki blokların yürütme sırasını değiştirir.

İstek Gövdesi

{
  "blockIds": [
    "11111111-1111-1111-1111-111111111111",
    "33333333-3333-3333-3333-333333333333",
    "22222222-2222-2222-2222-222222222222"
  ]
}

İstek Alanları

Alan Tür Zorunlu Açıklama
blockIds dizi Evet İstenen yürütme sırasına göre blok kimlikleri

Yanıt (200 OK)

Güncellenmiş blok sırasını döner.


Blok Yürütme Akışı

Bloklar, her bloğun veriyi ebeveyninden aldığı bir zincir oluşturur:

[Investigation Start]
       |
       v
[Filter: Activity Filter] -> Belirli etkinliklere filtre uygular
       |
       v
[Calculator: Duration] -> Filtrelenmiş veri için süreleri hesaplar
       |
       v
[Insight: Statistics] -> Hesaplanan veri üzerinde istatistikler oluşturur

Blokları yeniden sıraladığınızda, ebeveyn zinciri otomatik olarak güncellenir.


Uygulama Örnekleri

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):
        """Bir defterdeki tüm blokları listele."""
        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):
        """Yeni bir blok oluştur."""
        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):
        """Mevcut blok yürütme sırasını al."""
        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):
        """Defterdeki blokların sırasını değiştir."""
        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()

# Kullanım
manager = BlockManager('your-api-key')
notebook_id = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'

# Blokları listele
blocks = manager.list_blocks(notebook_id)
print(f"{blocks['totalCount']} blok bulundu")

# Bir filtre bloğu oluştur
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"Filtre oluşturuldu: {filter_block['blockId']}")

# Filtreden sonra bir hesaplayıcı bloğu oluştur
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"Hesaplayıcı oluşturuldu: {calc_block['blockId']}")

# Yürütme sırasını kontrol et
order = manager.get_block_order(notebook_id)
print(f"Blok sırası: {[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(`Başarısız oldu: ${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(`Başarısız oldu: ${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(`Başarısız oldu: ${response.status}`);
    return response.json();
  }
}

// Kullanım
const manager = new BlockManager('your-api-key');
const notebookId = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee';

// Blokları listele
const blocks = await manager.listBlocks(notebookId);
console.log(`${blocks.totalCount} blok bulundu`);

// Bloklar oluştur
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
});

En İyi Uygulamalar

  1. Blok Sırası Önemlidir: Veri ebeveynden çocuğa akar - iş akışınızı planlayın
  2. Şablonları Kullanın: Karmaşık iş akışları için şablonlardan oluşturun
  3. Yapılandırma JSON'u: Operatör özel ayarlarını JSON stringi olarak saklayın
  4. InsertAfter: Konumlandırmayı kontrol etmek için insertAfterBlockId kullanın
  5. Yürütme: Blokları oluşturduktan sonra defteri yürütün ve sonuçları görün