Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
352b26ac
Unverified
Commit
352b26ac
authored
7 years ago
by
Kyle Doherty
Browse files
Options
Downloads
Patches
Plain Diff
cleanup and translation
parent
ef0065d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/metabase/xray/components/InsightCard.jsx
+57
-86
57 additions, 86 deletions
frontend/src/metabase/xray/components/InsightCard.jsx
with
57 additions
and
86 deletions
frontend/src/metabase/xray/components/InsightCard.jsx
+
57
−
86
View file @
352b26ac
import
React
,
{
Component
}
from
'
react
'
import
{
//formatListOfItems,
formatTimeWithUnit
,
//inflect
}
from
"
metabase/lib/formatting
"
;
import
{
formatTimeWithUnit
}
from
"
metabase/lib/formatting
"
;
import
Icon
from
"
metabase/components/Icon
"
;
import
{
Link
}
from
"
react-router
"
;
import
Question
from
"
metabase-lib/lib/Question
"
;
import
{
TermWithDefinition
}
from
"
metabase/components/TermWithDefinition
"
;
import
{
t
}
from
'
c-3po
'
import
{
t
,
jt
}
from
'
c-3po
'
const
InsightText
=
({
children
})
=>
<
p
className
=
"text-paragraph"
>
...
...
@@ -30,14 +26,14 @@ const Feedback = ({ insightType }) =>
export
class
NormalRangeInsight
extends
Component
{
static
insightType
=
"
normal-range
"
static
title
=
"
Normal range of values
"
static
title
=
t
`
Normal range of values
`
static
icon
=
"
insight
"
render
()
{
const
{
lower
,
upper
,
features
:
{
model
}
}
=
this
.
props
return
(
<
InsightText
>
Most of the values for
{
model
.
display_name
||
model
.
name
}
are between
<
b
>
{
lower
}
</
b
>
and
<
b
>
{
upper
}
</
b
>
.
{
jt
`
Most of the values for
$
{
model
.
display_name
||
model
.
name
}
are between
${
<
b
>
{
lower
}<
/
b
>
}
and
$
{
<
b
>
{
upper
}
</
b
>
}
.` }
</
InsightText
>
)
}
...
...
@@ -45,7 +41,7 @@ export class NormalRangeInsight extends Component {
export class NilsInsight extends Component {
static insightType = "nils"
static
title
=
"
Missing data
"
static title =
t`
Missing
data
`
static icon = "warning"
render() {
...
...
@@ -62,7 +58,7 @@ export class NilsInsight extends Component {
// construct the question with filter
return (
<InsightText>
You have
{
quality
}
missing (null) values in your data.
{t`
You
have
$
{
quality
}
missing
(
null
)
values
in
your
data
`}
.
<span> </span>
{ table && <span><Link to={viewAllRowsUrl}>View all rows</Link> with missing value.</span> }
</InsightText>
...
...
@@ -72,7 +68,7 @@ export class NilsInsight extends Component {
export class ZerosInsight extends Component {
static insightType = "zeros"
static
title
=
"
Zeros in your data
"
static title =
t`
Zeros
in
your
data
`
static icon = "warning"
render() {
...
...
@@ -89,7 +85,7 @@ export class ZerosInsight extends Component {
// construct the question with filter
return (
<InsightText>
You have
{
quality
}
zeros in your data. They may be standins for missing data or indicate some other abnormality.
{ t`
You
have
$
{
quality
}
zeros
in
your
data
.
They
may
be
standins
for
missing
data
or
indicate
some
other
abnormality
.
` }
<span> </span>
{ table && <span><Link to={viewAllRowsUrl}>View all rows</Link> with zeros.</span> }
</InsightText>
...
...
@@ -97,12 +93,12 @@ export class ZerosInsight extends Component {
}
}
const
noisinessDefinition
=
"
Noisy data is highly variable jumping all over the place with changes carrying relatively little information.
"
const noisinessDefinition =
t`
Noisy
data
is
highly
variable
jumping
all
over
the
place
with
changes
carrying
relatively
little
information
.
`
const noisinessLink = "https://en.wikipedia.org/wiki/Noisy_data"
export class NoisinessInsight extends Component {
static insightType = "noisiness"
static
title
=
"
Noisy data
"
static title =
t`
Noisy
data
`
static icon = "warning"
render() {
...
...
@@ -117,19 +113,19 @@ export class NoisinessInsight extends Component {
link={noisinessLink}
>
noisy
</
TermWithDefinition
>
.
{
resolution
&&
` You might consider looking at it by
${
resolution
}
.`
}
</TermWithDefinition>.
{ resolution && `
You
might
consider
looking
at
it
by
$
{
resolution
}.
` }
</InsightText>
)
}
}
const
autocorrelationDefinition
=
"
Measure of how much (changes in) previous values predict future values.
"
const autocorrelationDefinition =
t`
Measure
of
how
much
(
changes
in
)
previous
values
predict
future
values
.
`
const autocorrelationLink = "https://en.wikipedia.org/wiki/Autocorrelation"
export class AutocorrelationInsight extends Component {
static insightType = "autocorrelation"
static
title
=
"
Autocorrelation
"
static title =
t`
Autocorrelation
`
static icon = "insight"
render() {
...
...
@@ -145,12 +141,12 @@ export class AutocorrelationInsight extends Component {
}
}
const
variationTrendDefinition
=
"
How variance in your data is changing over time.
"
const variationTrendDefinition =
t`
How
variance
in
your
data
is
changing
over
time
.
`
const varianceLink = "https://en.wikipedia.org/wiki/Variance"
export class VariationTrendInsight extends Component {
static insightType = "variation-trend"
static
title
=
`Trending variation`
static title =
t
`
Trending
variation
`
static icon = "insight"
render() {
...
...
@@ -168,7 +164,7 @@ export class VariationTrendInsight extends Component {
export class SeasonalityInsight extends Component {
static insightType = "seasonality"
static
title
=
"
Seasonality
"
static title =
t`
Seasonality
`
static icon = "insight"
render() {
...
...
@@ -176,18 +172,18 @@ export class SeasonalityInsight extends Component {
return (
<InsightText>
Your data has a
{
quality
}
seasonal compoment.
{ jt`
Your
data
has
a
$
{
quality
}
seasonal
compoment
.
` }
</InsightText>
)
}
}
const
multimodalDefinition
=
"
Data distribution with multiple peaks (modes).
"
const multimodalDefinition =
t`
Data
distribution
with
multiple
peaks
(
modes
).
`
const multimodalLink = "https://en.wikipedia.org/wiki/Multimodal_distribution"
export class MultimodalInsight extends Component {
static insightType = "multimodal"
static
title
=
"
Multimodal
"
static title =
t`
Multimodal
`
static icon = "warning"
render() {
...
...
@@ -203,75 +199,77 @@ export class MultimodalInsight extends Component {
export class OutliersInsight extends Component {
static insightType = "outliers"
static
title
=
"
Outliers
"
static title =
t`
Outliers
`
static icon = "warning"
render() {
const { filter, features: { table } } = this.props
const viewAllRowsUrl = table && Question.create()
.
query
()
// imitate the required hydrated metadata format
.
setTable
({
...
table
,
database
:
{
id
:
table
.
db_id
}})
.
addFilter
(
filter
)
.
question
()
.
getUrl
()
.query()
// imitate the required hydrated metadata format
.setTable({ ...table, database: { id: table.db_id }})
.addFilter(filter)
.question()
.getUrl()
// construct the question with filter
return
(
<
InsightText
>
return (
<InsightText>
You have some outliers.
<span> </span>
{ table && <span><Link to={viewAllRowsUrl}>View all rows</Link> with outliers.</span> }
</
InsightText
>
</InsightText>
)
}
}
export class StructuralBreaksInsight extends Component {
static insightType = "structural-breaks"
static
title
=
"
Structural breaks
"
static title =
t`
Structural
breaks
`
static icon = "insight"
render() {
const
{
breaks
,
features
:
{
resolution
}
}
=
this
.
props
const
breakPoints
=
breaks
.
map
(
(
point
,
idx
)
=>
{
point
=
formatTimeWithUnit
(
point
,
resolution
);
if
(
idx
==
breaks
.
length
-
1
&&
breaks
.
length
>
1
)
{
return
(
<
span
>
, and
{
point
}
</
span
>
)
}
else
{
return
(
<
span
>
{
idx
>
0
&&
<
span
>
,
</
span
>
}{
point
}
</
span
>
)
}
})
const { breaks, features: { resolution } } = this.props
const breakPoints = breaks.map( (point, idx) => {
point = formatTimeWithUnit(point, resolution);
if (idx == breaks.length - 1 && breaks.length > 1) {
return (
<span>, and { point }</span>
)
} else {
return (
<span>{ idx > 0 && <span>, </span>}{ point }</span>
)
}
})
return (
<InsightText>
It looks like your data has
{
breaks
.
length
>
1
&&
<
span
>
structural breaks
</
span
>
}
{
breaks
.
length
==
1
&&
<
span
>
a structural break
</
span
>
}
at
{
breakPoints
}
.
It looks like your data has
{ breaks.length > 1 && <span> structural breaks </span>}
{ breaks.length == 1 && <span> a structural break </span>}
at { breakPoints }.
</InsightText>
)
}
}
const
stationaryDefinition
=
"
Mean does not change with time.
"
const stationaryDefinition =
t`
Mean
does
not
change
with
time
.
`
const stationaryLink = "https://en.wikipedia.org/wiki/Stationary_process"
export class StationaryInsight extends Component {
static insightType = "stationary"
static
title
=
"
Stationary data
"
static title =
t`
Stationary
data
`
static icon = "insight"
render() {
return
(
<
InsightText
>
return (
<InsightText>
Your data looks to be <TermWithDefinition definition={stationaryDefinition} link={stationaryLink}>
stationary
</TermWithDefinition>.
...
...
@@ -282,7 +280,7 @@ export class StationaryInsight extends Component {
export class TrendInsight extends Component {
static insightType = "trend"
static
title
=
"
Trend
"
static title =
t`
Trend
`
static icon = "insight"
render() {
...
...
@@ -290,38 +288,12 @@ export class TrendInsight extends Component {
return(
<InsightText>
Your data seems to be
{
mode
}
{
shape
}
.
{ jt`
Your
data
seems
to
be
$
{
mode
}
$
{
shape
}.
` }
</InsightText>
)
}
}
/*
export class RegimeChangeInsight extends Component {
static insightType = "regime-change"
static title = "Regime change"
static icon = "insight"
getTextForBreak = ({ from, to, mode, shape }) => {
let { resolution } = this.props
resolution = resolution || "year"
if (from === "beginning") return `${mode} ${shape} period until ${formatTimeWithUnit(to, resolution)}`
if (to === "now") return `${mode} ${shape} period from ${formatTimeWithUnit(from, resolution)} until now`
return `${mode} ${shape} period from ${formatTimeWithUnit(from, resolution)} until now`
}
render() {
let { breaks } = this.props
return (
<p>
Your data can be split into { breaks.length } { inflect("stages", breaks.length) }:
<span> </span>
{ formatListOfItems(breaks.map(this.getTextForBreak)) }.
</p>
)
}
}
*/
const INSIGHT_COMPONENTS = [
// any field
NilsInsight,
...
...
@@ -338,7 +310,6 @@ const INSIGHT_COMPONENTS = [
StructuralBreaksInsight,
StationaryInsight,
TrendInsight,
// RegimeChangeInsight
]
export const InsightCard = ({type, props, features}) => {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment