-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api): dataset fields statistics #1360
Open
MFori
wants to merge
9
commits into
master
Choose a base branch
from
feat/dataset-field-statistics-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f8342c2
feat(api): dataset fields statistics
MFori a8237f4
update link in description
MFori 060b245
remove redundant fields
MFori fb34858
update endpoint description
MFori 425bbbc
update response description
MFori 4cc52db
use /v2/datasets/{datasetId}/statistics approach
MFori 2fb2806
fix indent
MFori c431a15
fieldStatistics nullable
MFori 05984dc
remove token from query params
MFori File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
apify-api/openapi/components/schemas/datasets/DatasetFieldStatistics.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
title: DatasetFieldStatistics | ||
type: object | ||
properties: | ||
min: | ||
type: number | ||
description: 'Minimum value of the field. For numbers, this is calculated directly. For strings, this is the length of the shortest string. For arrays, this is the length of the shortest array. For objects, this is the number of keys in the smallest object.' | ||
nullable: true | ||
max: | ||
type: number | ||
description: 'Maximum value of the field. For numbers, this is calculated directly. For strings, this is the length of the longest string. For arrays, this is the length of the longest array. For objects, this is the number of keys in the largest object.' | ||
nullable: true | ||
nullCount: | ||
type: number | ||
description: 'How many items in the dataset have a null value for this field.' | ||
nullable: true | ||
emptyCount: | ||
type: number | ||
description: 'How many items in the dataset are `undefined`, meaning that for example empty string is not considered empty.' | ||
nullable: true |
16 changes: 16 additions & 0 deletions
16
apify-api/openapi/components/schemas/datasets/GetDatasetStatisticsResponse.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
title: GetDatasetStatisticsResponse | ||
required: | ||
- data | ||
type: object | ||
properties: | ||
data: | ||
type: object | ||
properties: | ||
fieldStatistics: | ||
type: object | ||
nullable: true | ||
additionalProperties: | ||
$ref: ./DatasetFieldStatistics.yaml | ||
description: 'When you configure the dataset [fields schema](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation), we measure the statistics such as `min`, `max`, `nullCount` and `emptyCount` for each field. | ||
This property provides statistics for each field from dataset fields schema. | ||
<br/></br>See dataset field statistics [documentation](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation#dataset-field-statistics) for more information.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
apify-api/openapi/paths/datasets/datasets@{datasetId}@statistics.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
get: | ||
tags: | ||
- Datasets/Statistics | ||
summary: Get dataset statistics | ||
description: | | ||
Returns statistics for given dataset. | ||
Currently provides only [field statistics](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation#dataset-field-statistics). | ||
|
||
operationId: dataset_statistics_get | ||
parameters: | ||
- name: datasetId | ||
in: path | ||
description: Dataset ID or `username~dataset-name`. | ||
required: true | ||
style: simple | ||
schema: | ||
type: string | ||
example: WkzbQMuFYuamGv3YF | ||
- name: token | ||
in: query | ||
description: | | ||
API authentication token. It is required only when using the `username~dataset-name` format for `datasetId`. | ||
style: form | ||
explode: true | ||
schema: | ||
type: string | ||
example: soSkq9ekdmfOslopH | ||
responses: | ||
'200': | ||
description: '' | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "../../components/schemas/datasets/GetDatasetStatisticsResponse.yaml" | ||
example: | ||
data: | ||
fieldStatistics: | ||
name: | ||
nullCount: 122 | ||
price: | ||
min: 59 | ||
max: 89 | ||
# TODO: add clients methods | ||
# x-js-parent: DatasetClient | ||
# x-js-name: statistics | ||
# x-js-doc-url: https://docs.apify.com/api/client/js/reference/class/DatasetClient#statistics | ||
# x-py-parent: DatasetClientAsync | ||
# x-py-name: statistics | ||
# x-py-doc-url: https://docs.apify.com/api/client/python/reference/class/DatasetClientAsync#statistics |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtrunkat @netmilk - @drobnikj suggest in this PR to require the authentication always in this endpoint. Is it right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Let's make it authenticated = less work in the next months. As we will turn all endpoints this way.