LogoLogo
Log InSign UpHomepage
  • 👋Welcome
  • Account and Team Setup
    • Sign up
    • Subscription Plans
    • Profile information
    • Account information
    • Roles
    • Users
    • Tags
  • FAQ
  • UNDERSTANDING MACHINE LEARNING
    • What is Graphite Note
      • Graphite Note Insights Lifecycle
    • Introduction to Machine Learning
      • What is Machine Learning
      • Data Analitycs Maturity
    • Machine Learning concepts
      • Key Drivers
      • Confusion Matrix
      • Supervised vs Unsupervised ML
  • Demo datasets
    • Demo Datasets
      • Ads
      • Churn
      • CO2 Emission
      • Diamonds
      • eCommerce Orders
      • Housing Prices
      • Lead Scoring
      • Mall Customers
      • Marketing Mix
      • Car Sales
      • Store Item Demand
      • Upsell
    • What Dataset do I need for my use case?
      • Predict Cross Selling: Dataset
      • Predict Customer Churn: Dataset
      • Predictive Lead Scoring: Dataset
      • Predict Revenue : Dataset
      • Product Demand Forecast: Dataset
      • Predictive Ads Performance: Dataset
      • Media Mix Modeling (MMM): Dataset
      • Customer Lifetime Value Prediction : Dataset
      • RFM Customer Segmentation : Dataset
    • Dataset examples - from online sources
      • Free datasets for Machine Learning
  • Datasets
    • Introduction
    • Prepare your Data
      • Data Labeling
      • Expanding datasets
      • Merging datasets
      • CSV File creating and formatting
    • Data sources in Graphite Note
      • Import data from CSV file
        • Re-upload or append CSV
        • CSV upload troubleshooting tips
      • MySQL Connector
      • MariaDB Connector
      • PostgreSQL Connector
      • Redshift Connector
      • Big Query Connector
      • MS SQL Connector
      • Oracle Connector
  • Models
    • Introduction
    • Preprocessing Data
    • Machine Learning Models
      • Timeseries Forecast
      • Binary Classification
      • Multiclass Classification
      • Regression
      • General Segmentation
      • RFM Customer Segmentation
      • Customer Lifetime Value
      • Customer Cohort Analysis
      • ABC Pareto Analysis
      • New vs Returning Customers
    • Predict with ML Models
    • Overview and Model Health Check
    • Advanced parameters in ML Models
    • Actionable insights in ML Models
    • Improve your ML Models
  • Notebooks
    • What is Notebook?
    • My first Notebook
    • Data Visualization
  • REST API
    • API Introduction
    • Dataset API
      • Create
      • Fill
      • Complete
    • Prediction API
      • Quickstart
      • Request
        • Headers
        • Payload
        • Data
      • Response
        • Response Structure
      • API Limits
    • Model Results API
      • Quickstart
      • Request
        • Headers
        • Body
      • Response
      • Usage Notes
      • Code Examples
Powered by GitBook
On this page
  • Create a Dataset
  • Example Usage
  • Example Python Implementation

Was this helpful?

Export as PDF
  1. REST API
  2. Dataset API

Create

Use this API to create new datasets directly in Graphite Note environment, specifying the dataset's structure. This API is particularly useful for automating the setup of datasets during the onboarding process, allowing for easy integration with client-specific data requirements.

For example, use this endpoint to define the columns, types, and other properties for a new dataset tailored to your needs.

Create a Dataset

To create a new dataset, follow these steps:

url = 'https://app.graphite-note.com/api/dataset-create'
  1. To create a new dataset, make a POST request to /dataset-create with the required parameters in the request body.

  2. To specify the dataset structure, include an array of column definitions with each column's name, alias, type, subtype, and optional format.

  • Type can be:

    • measure

    • dimension

  • Subtype can be:

    • text

    • numeric

    • date

    • datetime

The response will include key details about the created dataset, including the dataset code, table name, and the number of columns.

Example Usage

Creating a New Dataset

For example, making a POST request to the following URL with the provided JSON body would result in the response below: Request

POST /dataset-create
Authorization: Bearer YOUR-TENANT-TOKEN

{
  "user-code": "0f02b4d4f9ae",
  "columns": [
    {
      "name": "InvoiceNo",
      "alias": "InvoiceNo",
      "type": "dimension",
      "subtype": "text"
    },
    {
      "name": "StockCode",
      "alias": "StockCode",
      "type": "dimension",
      "subtype": "text"
    },
    {
      "name": "Description",
      "alias": "Description",
      "type": "dimension",
      "subtype": "text"
    },
    {
      "name": "Quantity",
      "alias": "Quantity",
      "type": "measure",
      "subtype": "numeric",
      "format": "#,###.##"
    },
    {
      "name": "InvoiceDate",
      "alias": "InvoiceDate",
      "type": "dimension",
      "subtype": "datetime",
      "format": "Y-d-m H:i:s"
    },
    {
      "name": "UnitPrice",
      "alias": "UnitPrice",
      "type": "measure",
      "subtype": "numeric",
      "format": "#,###.##"
    },
    {
      "name": "CustomerID",
      "alias": "CustomerID",
      "type": "measure",
      "subtype": "numeric",
      "format": "#,###.##"
    }
  ],
  "name": "Client onboarding dataset creation"
}

Response

{
  "data": {
    "dataset-code": "eca2ad3940e3",
    "table-name": "dataset_csv_eca2ad3940e3",
    "columns": 7
  }
}

This request creates a dataset with the specified columns, each having unique names, types, and formats tailored to client onboarding requirements.

Example Python Implementation

import requests

# Replace with your actual tenant token
tenant_token = YOUR-TOKEN

# Replace with your actual endpoint URL
url = 'https://app.graphite-note.com/api/dataset-create'

# Payload for dataset creation
payload = {
    "user-code": YOUR-CODE,
    "columns": [
        {
            "name": "order",
            "alias": "order",
            "type": "dimension",
            "subtype": "text"
        },
        {
            "name": "customer_id",
            "alias": "customer_id",
            "type": "dimension",
            "subtype": "text"
        },
        {
            "name": "number_of_items",
            "alias": "number_of_items",
            "type": "measure",
            "subtype": "numeric",
            "format": "#,###.##"
        }
    ],
    "name": "API dataset test"
}

# Headers with the bearer token
headers = {
    "Authorization": f"Bearer {tenant_token}",
    "Content-Type": "application/json"
}

# Send the POST request
response = requests.post(url, json=payload, headers=headers)

# Print response
print("Status code:", response.status_code)
print("Response body:", response.json())
PreviousDataset APINextFill

Last updated 26 days ago

Was this helpful?