Skip to content
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

Auto-expand transformation #293

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4750db8
auto-expand transformation
HeikoTheissen Nov 10, 2023
53368e3
Avoid EnumType
HeikoTheissen Nov 10, 2023
64e5ae7
Instance annotations for auto-expanded result sets
HeikoTheissen Nov 14, 2023
b5a6f34
Reprased definitions
HeikoTheissen Nov 14, 2023
9238702
SortOrder -> SortOrderType
HeikoTheissen Nov 14, 2023
34b5a64
Avoid <dt>
HeikoTheissen Nov 14, 2023
443f99c
After alignment with @uhlmannm
HeikoTheissen Nov 15, 2023
2fb8ff2
rephrasing
HeikoTheissen Nov 15, 2023
f5dea9f
Make `LeafLevel` mandatory
HeikoTheissen Nov 15, 2023
41b289a
Don't call out instance annotation
HeikoTheissen Feb 2, 2024
2df14e4
Merge remote-tracking branch 'origin/main' into auto-expand
HeikoTheissen Apr 4, 2024
defafdf
Allowed values for DrillState
HeikoTheissen Apr 8, 2024
8584dfe
Merge remote-tracking branch 'origin/main' into auto-expand
HeikoTheissen Apr 11, 2024
f27abe8
auto-refreshed
HeikoTheissen Apr 11, 2024
3ca799d
@uhlmannm's suggestion
HeikoTheissen Apr 12, 2024
92f1abd
Simplifications agreed in V4 table meeting
HeikoTheissen Apr 26, 2024
bb78f7d
Example request
HeikoTheissen Apr 26, 2024
4181573
Rephrased
HeikoTheissen Apr 26, 2024
b227e7f
Typos
HeikoTheissen Apr 26, 2024
e390b0c
@uhlmannm's comments
HeikoTheissen Apr 29, 2024
b9ecf4f
explained example
HeikoTheissen Apr 29, 2024
b587137
expand N levels
HeikoTheissen Apr 29, 2024
ae774a6
renamed type
HeikoTheissen Apr 29, 2024
3cb5082
typo
HeikoTheissen Apr 29, 2024
c9bbadf
more links
HeikoTheissen Apr 29, 2024
3e6379a
corrected LeavesCount, ResultEntriesCount
HeikoTheissen Apr 29, 2024
f98c999
example formatting
HeikoTheissen Apr 29, 2024
64f96eb
save lines
HeikoTheissen Apr 29, 2024
bc35559
round parentheses for in
HeikoTheissen Apr 29, 2024
9f24039
More elegance
HeikoTheissen Apr 29, 2024
8c7b80b
reword: deeper -> finer-grained
HeikoTheissen Apr 29, 2024
4dfd1c6
Sort order like Common.SortOrderType
HeikoTheissen May 2, 2024
5036eba
As agreed in meeting on 2024-05-24
HeikoTheissen May 24, 2024
192cc17
Explain D vs. A
HeikoTheissen May 24, 2024
fbe94b9
Merge remote-tracking branch 'origin/main' into auto-expand
HeikoTheissen Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions vocabularies/Analytics.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
},
"https://sap.github.io/odata-vocabularies/vocabularies/Common.json": {
"$Include": [{ "$Namespace": "com.sap.vocabularies.Common.v1", "$Alias": "Common" }]
},
"https://sap.github.io/odata-vocabularies/vocabularies/Hierarchy.json": {
"$Include": [{ "$Namespace": "com.sap.vocabularies.Hierarchy.v1", "$Alias": "Hierarchy" }]
}
},
"com.sap.vocabularies.Analytics.v1": {
Expand Down Expand Up @@ -161,6 +164,113 @@
"@[email protected]": "Adding a list of other terms that can be annotated to it.",
"@Validation.ApplicableTerms": ["Common.Label"]
}
},
"AutoExpand": [
{
"$Kind": "Function",
"$EntitySetPath": "InputSet",
"$IsBound": true,
"@Common.Experimental": true,
"@Core.IsSignature": true,
"@Core.Description": "`$apply` transformation that expands an unnamed leveled hierarchy with custom aggregation of certain properties",
"$Parameter": [
{
"$Name": "InputSet",
"$Collection": true,
"$Type": "Edm.EntityType",
"@Core.Description": "Entity set to be processed"
},
{
"$Name": "Levels",
"$Collection": true,
"$Type": "Analytics.AutoExpandLevel",
"@Core.Description": "Collection of aggregation levels forming the visible part of a leveled hierarchy",
"@Core.LongDescription": "Each element in the collection defines the property names for one level.\n A property must not referenced by more than one level.\n The first element in the collection defines the property names of the coarsest level,\n the following elements define the property names of consecutively finer-grained aggregation levels.\n The function result comprises the leveled hierarchy with these levels in preorder.\n All referenced properties must be groupable."
},
{
"$Name": "LeafLevel",
"$Collection": true,
"@Core.Description": "A possibly empty set of property names that constitute, together with the property names from `Levels`, the leaf level of the leveled hierarchy",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A possibly empty set of property names

I wonder how that would work. If LeafLevel is empty then the last level in Levels is not expanded, cannot be expanded and could as well be written into LeafLevel?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't LeafLevel simply the last entry in Levels, then?

Copy link
Member

@uhlmannm uhlmannm Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can be several properties used for grouping on the leaf level that are not used for visual grouping / group headers.
The interesting part is that we have three things:

  1. properties used for visual grouping
  2. properties used additionally for grouping on the leaf level
  3. the number of visual groups initially expanded.

I think we had decided somewhen in the past that 3. is not necessary for the AutoExpand function as one can simply as collapsed visual groups to 2. But I wonder whether that decision is still good when introducing ExpandLevels. Should the backend then not know which visual groups are introduced, how grouping is done on leaf level and how deep to expand initially?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The leaf level is just the deepest grouping level, therefore we only need the parameter Levels, not LeafLevel.

In the current definition, nodes not mentioned in ExpandLevels are completely expanded. If you want the default to be "expand N levels", we need an additional parameter for that N.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can do it like that. But the question is how to denote the leaf level. Is it always the last of the Levels? And hence this last level is not and cannot be expanded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be stated explicitly in the Levels description?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the FE examples, then on the leaf level there are individual (unaggregated) records. If that is the target state, one could also argue that the last level can still be expanded and below this last level are the unaggregated records.

Copy link
Contributor Author

@HeikoTheissen HeikoTheissen Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

entries on the finest-grained level cannot be expanded further.

"@Core.LongDescription": "Property names that occur in `Levels` must not be repeated here.\n All referenced properties must be groupable."
},
{
"$Name": "Aggregation",
HeikoTheissen marked this conversation as resolved.
Show resolved Hide resolved
"$Collection": true,
"@Core.Description": "Properties to aggregate for all result entries on all levels",
"@Core.LongDescription": "All properties in this collection must be custom aggregates."
},
{
"$Name": "SiblingOrder",
"$Collection": true,
"$Type": "Analytics.AutoExpandSiblingOrder",
"@Core.Description": "Sort specification to apply to all direct descendants of a given entry in the resulting leveled hierarchy"
},
{
"$Name": "BeforeAggregationFilter",
"@Core.Description": "Expression valid for `filter` transformation to restrict the input set before any further procressing",
"@Core.OptionalParameter": {}
},
{
"$Name": "AggregatedValuesLeafFilter",
"@Core.Description": "Expression valid for `filter` transformation to restrict the input set at the most detailed grouping level with conditions on aggregated values",
"@Core.OptionalParameter": {}
},
{
"$Name": "Skip",
"$Type": "Edm.Int64",
"@Core.Description": "Number of entries to skip from the top of the fully ordered result",
"@Core.OptionalParameter": { "DefaultValue": "0" }
},
{
"$Name": "Top",
"$Type": "Edm.Int64",
"@Core.Description": "Number of entries to return from the result set after any skipping (absent means all)",
"@Core.OptionalParameter": {}
},
{
"$Name": "ResultEntriesCount",
"$Type": "Edm.Bool",
"@Core.Description": "Whether to return the total number of entries in the result independent of Skip/Top",
"@Core.OptionalParameter": { "DefaultValue": "false" }
}
],
"$ReturnType": {
"$Collection": true,
"$Type": "Edm.EntityType",
"@Core.Description": "Output set including the instance annotation [`LevelInformation`](#LevelInformation)"
}
}
],
"AutoExpandLevel": {
"$Kind": "ComplexType",
"@Common.Experimental": true,
"P": { "$Collection": true, "@Core.Description": "A non-empty set of property names constituting a level" }
HeikoTheissen marked this conversation as resolved.
Show resolved Hide resolved
},
"AutoExpandSiblingOrder": {
"$Kind": "ComplexType",
"@Common.Experimental": true,
"Property": { "@Core.Description": "Property by which to sort" },
"Order": {
"$Type": "Analytics.SortOrderType",
"$DefaultValue": "Analytics.SortOrderType/Asc",
"@Core.Description": "Sorting direction"
}
},
"SortOrderType": {
"$Kind": "TypeDefinition",
"$UnderlyingType": "Edm.String",
"@Common.Experimental": true,
"@Validation.AllowedValues": [
{ "Value": "asc", "@Core.Description": "Sort in ascending order" },
{ "Value": "desc", "@Core.Description": "Sort in descending order" }
]
},
"LevelInformation": {
"$Kind": "Term",
"$Type": "Hierarchy.HierarchyType",
"$AppliesTo": ["EntityType"],
"@Common.Experimental": true,
"@Core.Description": "Information about grouping levels in the result set of a request including the [`AutoExpand`](#AutoExpand) transformation"
}
}
}
Loading