Get detailed statistics for a snapshot
curl --request GET \
--url https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"columns_summary": [
{
"name": "age",
"type": "LONG",
"basic_statistics": {
"nan_value_count": null,
"null_value_count": 0,
"lower_bound": 22,
"upper_bound": 52,
"value_count": 60,
"column_store_bytes": 655
},
"advanced_statistics": {
"approx_count_distinct": 13,
"count_distinct": null,
"histogram": {
"values": {
"22": {
"absolute": 3,
"ratio": 0.0667
},
"25": {
"absolute": 3,
"ratio": 0.0667
},
"28": {
"absolute": 9,
"ratio": 0.2
},
"31": {
"absolute": 3,
"ratio": 0.0667
},
"32": {
"absolute": 3,
"ratio": 0.0667
},
"34": {
"absolute": 3,
"ratio": 0.0667
},
"36": {
"absolute": 3,
"ratio": 0.0667
},
"39": {
"absolute": 3,
"ratio": 0.0667
},
"40": {
"absolute": 3,
"ratio": 0.0667
},
"45": {
"absolute": 3,
"ratio": 0.0667
},
"47": {
"absolute": 3,
"ratio": 0.0667
},
"50": {
"absolute": 3,
"ratio": 0.0667
},
"52": {
"absolute": 3,
"ratio": 0.0667
}
},
"number_of_bins": 13
},
"mean": 35.8,
"standard_deviation": 9.064215354899726,
"completeness": 1,
"observed_types": null
}
}
],
"advanced_statistics_metadata": {
"snapshot_range": null,
"configuration": {
"value_histogram": {
"columns": [
"firstName",
"secondName",
"firstChars",
"age"
]
},
"completeness": {
"columns": [
"firstName",
"secondName",
"firstChars",
"age"
]
},
"approx_count_distinct": {
"columns": [
"firstChars",
"age"
]
},
"count_distinct": {
"columns": [
"firstName",
"secondName"
]
},
"observed_types_histogram": {
"columns": [
"firstName"
]
},
"mean": {
"columns": [
"age"
]
},
"deviation": {
"columns": [
"age"
]
}
}
}
}Datasets
Get detailed statistics for a snapshot
Get statistics for each column as they were at one snapshot of the dataset. Same shape as
GET /datasets/{dataset_id}/column-stats, which describes the current state.
GET
/
datasets
/
{dataset_id}
/
column-stats
/
{snapshot_id}
Get detailed statistics for a snapshot
curl --request GET \
--url https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/datasets/{dataset_id}/column-stats/{snapshot_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"columns_summary": [
{
"name": "age",
"type": "LONG",
"basic_statistics": {
"nan_value_count": null,
"null_value_count": 0,
"lower_bound": 22,
"upper_bound": 52,
"value_count": 60,
"column_store_bytes": 655
},
"advanced_statistics": {
"approx_count_distinct": 13,
"count_distinct": null,
"histogram": {
"values": {
"22": {
"absolute": 3,
"ratio": 0.0667
},
"25": {
"absolute": 3,
"ratio": 0.0667
},
"28": {
"absolute": 9,
"ratio": 0.2
},
"31": {
"absolute": 3,
"ratio": 0.0667
},
"32": {
"absolute": 3,
"ratio": 0.0667
},
"34": {
"absolute": 3,
"ratio": 0.0667
},
"36": {
"absolute": 3,
"ratio": 0.0667
},
"39": {
"absolute": 3,
"ratio": 0.0667
},
"40": {
"absolute": 3,
"ratio": 0.0667
},
"45": {
"absolute": 3,
"ratio": 0.0667
},
"47": {
"absolute": 3,
"ratio": 0.0667
},
"50": {
"absolute": 3,
"ratio": 0.0667
},
"52": {
"absolute": 3,
"ratio": 0.0667
}
},
"number_of_bins": 13
},
"mean": 35.8,
"standard_deviation": 9.064215354899726,
"completeness": 1,
"observed_types": null
}
}
],
"advanced_statistics_metadata": {
"snapshot_range": null,
"configuration": {
"value_histogram": {
"columns": [
"firstName",
"secondName",
"firstChars",
"age"
]
},
"completeness": {
"columns": [
"firstName",
"secondName",
"firstChars",
"age"
]
},
"approx_count_distinct": {
"columns": [
"firstChars",
"age"
]
},
"count_distinct": {
"columns": [
"firstName",
"secondName"
]
},
"observed_types_histogram": {
"columns": [
"firstName"
]
},
"mean": {
"columns": [
"age"
]
},
"deviation": {
"columns": [
"age"
]
}
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier for a dataset.
Unique identifier for a snapshot.
Query Parameters
The maximum number of bins to return for the histograms.
Response
OK
Show child attributes
Show child attributes
How the advanced statistics were computed. Null when none were.
Show child attributes
Show child attributes
Example:
{
"snapshot_range": null,
"configuration": {
"value_histogram": {
"columns": [
"firstName",
"secondName",
"firstChars",
"age"
]
},
"completeness": {
"columns": [
"firstName",
"secondName",
"firstChars",
"age"
]
},
"approx_count_distinct": { "columns": ["firstChars", "age"] },
"count_distinct": { "columns": ["firstName", "secondName"] },
"observed_types_histogram": { "columns": ["firstName"] },
"mean": { "columns": ["age"] },
"deviation": { "columns": ["age"] }
}
}
Was this page helpful?

