Skip to content
Snippets Groups Projects
Commit ba31d86c authored by Simon Belak's avatar Simon Belak
Browse files

Introduce [[this.foo]] syntax and make GenericTable and segments nice

parent 86396d19
No related branches found
No related tags found
No related merge requests found
......@@ -91,13 +91,13 @@ groups:
- Overview:
title: Summary
- Singletons:
title: These are the same for all your [[this]]
title: These are the same for all your [[this.short-name]]
- ByTime:
title: "[[this]] across time"
title: "[[this.short-name]] across time"
- Geographical:
title: Where your [[this]] are
title: Where your [[this.short-name]] are
- General:
title: How [[this]] is distributed
title: How [[this.short-name]] are distributed
dashboard_filters:
- Timestamp
- Date
......@@ -112,13 +112,13 @@ dashboard_filters:
cards:
# Overview
- Rowcount:
title: Total [[this]]
title: Total [[this.short-name]]
visualization: scalar
metrics: Count
score: 100
group: Overview
- RowcountLast30Days:
title: New [[this]] in the last 30 days
title: New [[this.short-name]] in the last 30 days
visualization: scalar
metrics: Count
score: 100
......@@ -132,7 +132,7 @@ cards:
group: Overview
# General
- NumberDistribution:
title: How [[this]] are distributed across [[GenericNumber]]
title: How [[this.short-name]] are distributed across [[GenericNumber]]
dimensions:
- GenericNumber:
aggregation: default
......@@ -141,7 +141,7 @@ cards:
score: 90
group: General
- CountByCategoryMedium:
title: "[[this]] per [[GenericCategoryMedium]]"
title: "[[this.short-name]] per [[GenericCategoryMedium]]"
dimensions: GenericCategoryMedium
metrics: Count
visualization: row
......@@ -151,7 +151,7 @@ cards:
order_by:
- Count: descending
- CountByCategoryLarge:
title: "[[this]] per [[GenericCategoryLarge]]"
title: "[[this.short-name]] per [[GenericCategoryLarge]]"
dimensions: GenericCategoryLarge
metrics: Count
visualization: table
......@@ -162,7 +162,7 @@ cards:
- Count: descending
# Geographical
- CountByCountry:
title: "[[this]] per country"
title: "[[this.short-name]] per country"
metrics: Count
dimensions: Country
score: 90
......@@ -173,7 +173,7 @@ cards:
group: Geographical
height: 6
- CountByState:
title: "[[this]] per state"
title: "[[this.short-name]] per state"
metrics: Count
dimensions: State
score: 90
......@@ -184,7 +184,7 @@ cards:
group: Geographical
height: 6
- CountByCoords:
title: "[[this]] by coordinates"
title: "[[this.short-name]] by coordinates"
metrics: Count
dimensions:
- Long
......@@ -195,42 +195,42 @@ cards:
height: 6
# By Time
- CountByJoinDate:
title: "[[this]] that have joined over time"
title: "[[this.short-name]] that have joined over time"
visualization: line
dimensions: JoinTimestamp
metrics: Count
score: 90
group: ByTime
- CountByJoinDate:
title: "[[this]] that have joined over time"
title: "[[this.short-name]] that have joined over time"
visualization: line
dimensions: JoinDate
metrics: Count
score: 90
group: ByTime
- CountByCreateDate:
title: New [[this]] over time
title: New [[this.short-name]] over time
visualization: line
dimensions: CreateTimestamp
metrics: Count
score: 90
group: ByTime
- CountByCreateDate:
title: New [[this]] over time
title: New [[this.short-name]] over time
visualization: line
dimensions: CreateDate
metrics: Count
score: 90
group: ByTime
- CountByTimestamp:
title: "[[this]] by [[Timestamp]]"
title: "[[this.short-name]] by [[Timestamp]]"
visualization: line
dimensions: Timestamp
metrics: Count
score: 20
group: ByTime
- CountByTimestamp:
title: "[[this]] by [[Timestamp]]"
title: "[[this.short-name]] by [[Timestamp]]"
visualization: line
dimensions: Date
metrics: Count
......@@ -371,7 +371,7 @@ cards:
group: ByTime
x_label: "[[Timestamp]]"
- DayOfWeekCreateDate:
title: Weekdays when new [[this]] were added
title: Weekdays when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateTimestamp:
......@@ -381,7 +381,7 @@ cards:
group: ByTime
x_label: Created At by day of the week
- DayOfWeekCreateDate:
title: Weekdays when new [[this]] were added
title: Weekdays when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateDate:
......@@ -391,7 +391,7 @@ cards:
group: ByTime
x_label: Created At by day of the week
- HourOfDayCreateDate:
title: Hours when new [[this]] were added
title: Hours when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateTimestamp:
......@@ -401,7 +401,7 @@ cards:
group: ByTime
x_label: Created At by hour of the day
- HourOfDayCreateDate:
title: Hours when new [[this]] were added
title: Hours when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateTime:
......@@ -411,7 +411,7 @@ cards:
group: ByTime
x_label: Created At by hour of the day
- DayOfMonthCreateDate:
title: Days when new [[this]] were added
title: Days when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateTimestamp:
......@@ -421,7 +421,7 @@ cards:
group: ByTime
x_label: Created At by day of the month
- DayOfMonthCreateDate:
title: Days when new [[this]] were added
title: Days when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateDate:
......@@ -431,7 +431,7 @@ cards:
group: ByTime
x_label: Created At by day of the month
- MonthOfYearCreateDate:
title: Months when new [[this]] were added
title: Months when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateTimestamp:
......@@ -441,7 +441,7 @@ cards:
group: ByTime
x_label: Created At by month of the year
- MonthOfYearCreateDate:
title: Months when new [[this]] were added
title: Months when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateDate:
......@@ -451,7 +451,7 @@ cards:
group: ByTime
x_label: Created At by month of the year
- QuerterOfYearCreateDate:
title: Quarters when new [[this]] were added
title: Quarters when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateTimestamp:
......@@ -461,7 +461,7 @@ cards:
group: ByTime
x_label: Created At by quarter of the year
- QuerterOfYearCreateDate:
title: Quarters when new [[this]] were added
title: Quarters when new [[this.short-name]] were added
visualization: bar
dimensions:
- CreateDate:
......@@ -471,7 +471,7 @@ cards:
group: ByTime
x_label: Created At by quarter of the year
- DayOfWeekJoinDate:
title: Weekdays when [[this]] joined
title: Weekdays when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinTimestamp:
......@@ -481,7 +481,7 @@ cards:
group: ByTime
x_label: Join date by day of the week
- DayOfWeekJoinDate:
title: Weekdays when [[this]] joined
title: Weekdays when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinDate:
......@@ -491,7 +491,7 @@ cards:
group: ByTime
x_label: Join date by day of the week
- HourOfDayJoinDate:
title: Hours when [[this]] joined
title: Hours when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinTimestamp:
......@@ -501,7 +501,7 @@ cards:
group: ByTime
x_label: Join date by hour of the day
- HourOfDayJoinDate:
title: Hours when [[this]] joined
title: Hours when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinTime:
......@@ -511,7 +511,7 @@ cards:
group: ByTime
x_label: Join date by hour of the day
- DayOfMonthJoinDate:
title: Days of the month when [[this]] joined
title: Days of the month when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinTimestamp:
......@@ -521,7 +521,7 @@ cards:
group: ByTime
x_label: Join date by day of the month
- DayOfMonthJoinDate:
title: Days of the month when [[this]] joined
title: Days of the month when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinDate:
......@@ -531,7 +531,7 @@ cards:
group: ByTime
x_label: Join date by day of the month
- MonthOfYearJoinDate:
title: Months when [[this]] joined
title: Months when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinTimestamp:
......@@ -541,7 +541,7 @@ cards:
group: ByTime
x_label: Join date by month of the year
- MonthOfYearJoinDate:
title: Months when [[this]] joined
title: Months when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinDate:
......@@ -551,7 +551,7 @@ cards:
group: ByTime
x_label: Join date by month of the year
- QuerterOfYearJoinDate:
title: Quarters when [[this]] joined
title: Quarters when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinTimestamp:
......@@ -561,7 +561,7 @@ cards:
group: ByTime
x_label: Join date by quarter of the year
- QuerterOfYearJoinDate:
title: Quarters when [[this]] joined
title: Quarters when [[this.short-name]] joined
visualization: bar
dimensions:
- JoinDate:
......
......@@ -54,9 +54,9 @@ groups:
- Overview:
title: Overview
- Geographical:
title: Where these [[this]] are
title: Where these [[this.short-title]] are
- General:
title: How these [[this]] are distributed
title: How these [[this.short-title]] are distributed
dashboard_filters:
- JoinDate
- GenericCategoryMedium
......@@ -66,7 +66,7 @@ dashboard_filters:
cards:
# Overview
- Rowcount:
title: Total [[this]]
title: Total [[this.short-title]]
visualization: scalar
metrics: Count
score: 100
......@@ -74,7 +74,7 @@ cards:
width: 5
height: 3
- RowcountLast30Days:
title: New [[this]] in the last 30 days
title: New [[this.short-title]] in the last 30 days
visualization: scalar
metrics: Count
score: 100
......@@ -84,8 +84,8 @@ cards:
height: 3
- NewUsersByMonth:
visualization: line
title: New [[this]] per month
description: The number of new [[this]] each month
title: New [[this.short-tiltle]] per month
description: The number of new [[this.short-title]] each month
dimensions: JoinDate
metrics: Count
score: 100
......@@ -94,7 +94,7 @@ cards:
height: 7
# Geographical
- CountByCountry:
title: Number of [[this]] per country
title: Number of [[this.short-title]] per country
metrics: Count
dimensions: Country
score: 90
......@@ -104,7 +104,7 @@ cards:
map.region: world_countries
group: Geographical
- CountByState:
title: "[[this]] per state"
title: "[[this.short-title]] per state"
metrics: Count
dimensions: State
score: 90
......@@ -115,7 +115,7 @@ cards:
map.region: us_states
group: Geographical
- CountByCoords:
title: "[[this]] by coordinates"
title: "[[this.short-title]] by coordinates"
metrics: Count
dimensions:
- Long
......@@ -135,7 +135,7 @@ cards:
score: 90
group: General
- CountByCategoryMedium:
title: "[[this]] per [[GenericCategoryMedium]]"
title: "[[this.short-title]] per [[GenericCategoryMedium]]"
dimensions: GenericCategoryMedium
metrics: Count
visualization: row
......@@ -145,7 +145,7 @@ cards:
order_by:
- Count: descending
- CountByCategoryLarge:
title: "[[this]] per [[GenericCategoryLarge]]"
title: "[[this.short-title]] per [[GenericCategoryLarge]]"
dimensions: GenericCategoryLarge
metrics: Count
visualization: table
......
......@@ -116,6 +116,7 @@
:full-name (if (isa? (:entity_type table) :entity/GoogleAnalyticsTable)
(:display_name table)
(tru "{0} table" (:display_name table)))
:short-name (:display_name table)
:source table
:database (:db_id table)
:url (format "%stable/%s" public-endpoint (u/get-id table))
......@@ -126,6 +127,7 @@
(let [table (-> segment :table_id Table)]
{:entity segment
:full-name (tru "{0} in {1} segment" (:display_name table) (:name segment))
:short-name (tru "such {0}" (:display_name table))
:source table
:database (:db_id table)
:query-filter (-> segment :definition :filter)
......@@ -137,6 +139,7 @@
(let [table (-> metric :table_id Table)]
{:entity metric
:full-name (tru "{0} metric" (:name metric))
:short-name (:name metric)
:source table
:database (:db_id table)
;; We use :id here as it might not be a concrete field but rather one from a nested query which
......@@ -149,6 +152,7 @@
(let [table (field/table field)]
{:entity field
:full-name (tru "{0} field" (:display_name field))
:short-name (:display_name field)
:source table
:database (:db_id table)
;; We use :id here as it might not be a concrete metric but rather one from a nested query
......@@ -353,8 +357,11 @@
bindings)
(comp first #(filter-tables % tables) rules/->entity)
identity)]
(str/replace s #"\[\[(\w+)\]\]" (fn [[_ identifier]]
(->reference template-type (bindings identifier))))))
(str/replace s #"\[\[(\w+)(?:\.([\w\-]+))?\]\]"
(fn [[_ identifier attribute]]
(let [entity (bindings identifier)]
(or (some-> attribute qp.util/normalize-token root)
(->reference template-type entity)))))))
(defn- field-candidates
[context {:keys [field_type links_to named max_cardinality] :as constraints}]
......@@ -860,9 +867,10 @@
(-> dashboard :context :filters u/pprint-to-str))
(-> (cond-> dashboard
cell-query
(assoc :title (tru "A closer look at {0}"
(cell-title (:context dashboard) cell-query))
:transient_title nil)
(assoc :transient_title nil
:title (tru "A closer look at {0}" (cell-title (:context dashboard)
cell-query)))
query-filter
(assoc :title (tru "A closer look at {0}" (:full-name root))))
(populate/create-dashboard (or show max-cards))
......@@ -935,7 +943,7 @@
(u/get-id card)
(encode-base64-json cell-query))
:entity (:source root)
:full-name (->> root
:short-name (->> root
:source
((some-fn :display_name :name))
(tru "such {0}"))
......@@ -957,7 +965,7 @@
(encode-base64-json (:dataset_query query))
(encode-base64-json cell-query))
:entity (:source root)
:full-name (->> root
:short-name (->> root
:source
((some-fn :display_name :name))
(tru "such {0}"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment