Skip to main content

Elastic Data Tools

Query custom elastic datasets — user-defined data structures with flexible schemas for tracking any type of operational data beyond the standard emission categories. Each dataset has its own field definitions and records, and can optionally extend a native Dcycle entity (facilities, vehicles, etc.).

list_datasets

List all elastic datasets for the organization. Parameters:
ParameterTypeRequiredDefaultDescription
organization_idstringNodefault orgOrganization UUID
Example response:
[
  {
    "id": "ds1a2b3c-...",
    "name": "Water Quality Monitoring",
    "slug": "water-quality-monitoring",
    "description": "Monthly water quality samples from all facilities",
    "entity_type": "facilities",
    "record_count": 342,
    "organization_id": "a1b2c3d4-...",
    "created_at": "2024-06-15T09:00:00"
  },
  {
    "id": "ds4e5f6a-...",
    "name": "Supplier Emissions Data",
    "slug": "supplier-emissions-data",
    "description": null,
    "entity_type": "suppliers",
    "record_count": 89,
    "organization_id": "a1b2c3d4-...",
    "created_at": "2025-01-20T14:30:00"
  }
]
Key response fields:
FieldDescription
nameHuman-readable dataset name
slugURL-friendly identifier
entity_typeNative Dcycle entity this dataset extends (null for standalone)
record_countNumber of records in the dataset

get_dataset

Get a dataset by ID with its full field definitions (schema). Parameters:
ParameterTypeRequiredDefaultDescription
dataset_idstringYesUUID of the dataset
organization_idstringNodefault orgOrganization UUID
Example response:
{
  "id": "ds1a2b3c-...",
  "name": "Water Quality Monitoring",
  "slug": "water-quality-monitoring",
  "entity_type": "facilities",
  "fields": [
    {
      "id": "f1a2b3c4-...",
      "key": "sample_date",
      "name": "Sample Date",
      "data_type": "date",
      "required": true,
      "position": 0,
      "has_values": true
    },
    {
      "id": "f5e6f7a8-...",
      "key": "ph_level",
      "name": "pH Level",
      "data_type": "decimal",
      "required": false,
      "position": 1,
      "has_values": true,
      "classification": "metric"
    },
    {
      "id": "f9b0c1d2-...",
      "key": "status",
      "name": "Compliance Status",
      "data_type": "select",
      "required": true,
      "position": 2,
      "options": { "values": ["compliant", "non_compliant", "pending"] }
    }
  ]
}
TypeDescription
textFree-form text
integerWhole numbers
decimalDecimal numbers
booleanTrue/false
dateDate (YYYY-MM-DD)
datetimeDate and time
selectSingle choice from predefined options
referenceUUID reference to another dataset’s record
quantity_unitComposite value with unit (e.g. {"value": "12.5", "unit": "kg"})

query_dataset

Query records from a dataset with pagination. Parameters:
ParameterTypeRequiredDefaultDescription
dataset_idstringYesUUID of the dataset
organization_idstringNodefault orgOrganization UUID
pageintegerNo1Page number
sizeintegerNo50Results per page
Example response:
{
  "items": [
    {
      "id": "r1a2b3c4-...",
      "data": {
        "sample_date": "2025-03-15",
        "ph_level": 7.2,
        "status": "compliant"
      }
    }
  ],
  "total": 342,
  "page": 1,
  "size": 50,
  "pages": 7
}
Records are stored as JSONB — the data object uses the field key values from the dataset schema. Call get_dataset first to understand what fields exist and their types.
Example prompts:
"What custom datasets do we have?"
"Show me the schema for our water quality dataset"
"Query the first 20 records from dataset ds-123"
"How many records are in our supplier emissions dataset?"
"What fields does the energy tracking dataset have?"

Workflow

  1. Discover datasetslist_datasets to see available custom datasets and their record counts
  2. Understand schemaget_dataset to see field definitions, types, and options
  3. Query recordsquery_dataset to retrieve the actual data
  4. Cross-reference — If entity_type is set, use the corresponding tool (e.g. list_facilities) to link records to native entities

Custom KPIs

KPI definitions that can be built on elastic datasets

Files

File uploads that can populate elastic datasets