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

refine ai pipelines #310

Merged
merged 4 commits into from
May 29, 2024
Merged

refine ai pipelines #310

merged 4 commits into from
May 29, 2024

Conversation

cyyeh
Copy link
Member

@cyyeh cyyeh commented May 23, 2024

  • follow-up improvement

@cyyeh cyyeh force-pushed the feature/ai-service/refine-pipelines branch 2 times, most recently from ceacff0 to 078bfb4 Compare May 26, 2024 04:31
@cyyeh cyyeh force-pushed the feature/ai-service/refine-pipelines branch from 078bfb4 to 4d28294 Compare May 28, 2024 13:55
@cyyeh cyyeh marked this pull request as ready for review May 29, 2024 01:35
@cyyeh cyyeh requested a review from paopa May 29, 2024 01:35
@cyyeh cyyeh added the module/ai-service ai-service related label May 29, 2024
Comment on lines -630 to +540
"metrics": [
{
"name": "Revenue",
"baseObject": "orders",
"dimension": [
{
"name": "PurchaseTimestamp",
"type": "TIMESTAMP"
},
{
"name": "CustomerId",
"type": "VARCHAR"
},
{
"name": "Status",
"type": "VARCHAR"
},
{
"name": "Size",
"type": "BIGINT"
},
{
"name": "IsReviewed",
"type": "BOOLEAN"
}
],
"measure": [
{
"name": "Price",
"type": "DOUBLE",
"expression": "sum(order_items.Price)"
},
{
"name": "MoM_Price",
"type": "DOUBLE",
"expression": "sum(order_items.Price) - COALESCE(LAG(sum(order_items.Price)) OVER (ORDER BY date_trunc('MONTH', PurchaseTimestamp)), 0) / COALESCE(LAG(sum(order_items.Price)) OVER (ORDER BY date_trunc('MONTH', PurchaseTimestamp)), 1)"
},
{
"name": "NumberOfOrders",
"type": "BIGINT",
"expression": "count(OrderId)"
},
{
"name": "Peak",
"type": "DOUBLE",
"expression": "max(TotalValue)"
}
],
"timeGrain": [
{
"name": "PurchaseTimestamp",
"refColumn": "PurchaseTimestamp",
"dateParts": [
"YEAR",
"MONTH",
"DAY"
]
}
]
}
],
"metrics": [],
"cumulativeMetrics": [],
"views": [
{
"name": "total_items_view",
"statement": "WITH customer_order_items AS (SELECT c.State, oi.ItemNumber FROM customers c JOIN orders o ON c.Id = o.CustomerId JOIN order_items oi ON o.OrderId = oi.OrderId) SELECT State, COUNT(ItemNumber) AS Total_Items_Purchased FROM customer_order_items GROUP BY State",
"properties": {
"question": "How many items have been purchased in orders placed by customers in each state?",
"summary": "The query counts the total number of items purchased by customers in each state.",
"viewId": "20b69c05-e9a3-4c4d-a421-06ba7e7a385a"
}
}
],
"macros": [
{
"name": "MoM",
"definition": "(calculation: Expression, timestamp: Expression) => ({{ calculation }} - COALESCE(LAG({{ calculation }}) OVER (ORDER BY {{ timestamp }}), 0)) / COALESCE(LAG({{ calculation }}) OVER (ORDER BY {{ timestamp }}), 1)"
}
],
"views": [],
"macros": [],
Copy link
Member

Choose a reason for hiding this comment

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

curiously, why remove them?

Copy link
Member

Choose a reason for hiding this comment

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

after an offline discussion with @cyyeh, we will keep the MDL file the same as the sample dataset, and add another MDL file with the views and other items section.

@cyyeh cyyeh merged commit f9fe348 into main May 29, 2024
3 checks passed
@cyyeh cyyeh deleted the feature/ai-service/refine-pipelines branch May 29, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/ai-service ai-service related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants