# Only the dataSources key will be used from the exmaple config
dataSources:

  - name: wiki

    # This is the title that will grace this data source in the the menus
    title: Wikipedia Example

    # Use the native engine, all calculations will be done in Node.JS. Good for up to 100k rows of data.
    engine: native

    # The file representing the datasource relative to repo root
    source: assets/data/wikiticker-2015-09-12-sampled.json
    # This datasource was scraped using https://github.com/implydata/wikiticker
    # GitHub does not like large files so only a sampled file is checked in
    # There is also a non-sampled file with the filter: isAnonymous == true applied, to use it set:
    # source: assets/data/wikiticker-2015-09-12-anonymous.json
    # Run `assets/data/process-wikiticker-2015-09-12` to get the full example file

    # The primary time attribute of the data refers to the attribute that must always be filtered on
    # This is particularly useful for Druid data sources as they must always have a time filter.
    timeAttribute: time

    # The refresh rule describes how often the data source looks for new data. Default: 'query'/PT1M (every minute)
    # In this case it has to be fixed since this data source is static
    refreshRule:
      rule: fixed # also possible: 'query' and 'realtime'
      time: 2015-09-13T00:00:00Z

    # The default duration for the time filter (if not set P1D is used)
    defaultDuration: P1D

    # The default sort measure name (if not set the first measure name is used)
    defaultSortMeasure: delta

    # The default filter in the UI, must be an AND of INs (or just a single IN)
    #defaultFilter: $channel.in(["#en.wikipedia", "#de.wikipedia"])

    # The names of dimensions that are pinned by default (in order that they will appear in the pin bar
    defaultPinnedDimensions:
      - channel
      - namespace
      - isRobot

    introspection: no-autofill

    attributeOverrides:
      - name: sometimeLater
        type: TIME

      - name: commentLength
        type: NUMBER

      - name: deltaBucket100
        type: NUMBER

    dimensions:
      - name: time
        type: TIME
        kind: time
        expression: $time

    #  - name: sometimeLater
    #    title: Sometime Later
    #    kind: time

      - name: channel
        title: Channel
        expression: $channel

      - name: cityName
        title: City Name
        expression: $cityName

      - name: comment
        title: Comment
        expression: $comment

      - name: commentLength
        title: Comment Length
        expression: $commentLength
        kind: number

      - name: commentLengthOver100
        title: Comment Length Over 100
        expression: $commentLength > 100
        kind: boolean

      - name: countryIso
        title: Country ISO
        expression: $countryIsoCode

      - name: countryName
        title: Country Name
        expression: $countryName

      - name: deltaBucket100
        title: Delta Bucket
        expression: $deltaBucket100
        kind: number

      - name: isAnonymous
        title: Is Anonymous
        kind: boolean

      - name: isMinor
        title: Is Minor
        kind: boolean

      - name: isNew
        title: Is New
        kind: boolean

      - name: isRobot
        title: Is Robot
        kind: boolean

      - name: isUnpatrolled
        title: Is Unpatrolled
        expression: $isUnpatrolled

      - name: metroCode
        title: Metro Code
        expression: $metroCode

      - name: namespace
        title: Namespace
        expression: $namespace

      - name: page
        title: Page
        expression: $page

      - name: regionIso
        title: Region ISO
        expression: $regionIsoCode

      - name: regionName
        title: Region Name
        expression: $regionName

      - name: user
        title: User
        expression: $user

      - name: userChars
        title: User Chars
        expression: $userChars


    measures:

      - name: count
        title: Rows
        expression: $main.count()

      - name: delta

      - name: avg_delta
        expression: $main.average($delta)

      - name: added

      - name: avg_added
        expression: $main.average($added)

      - name: deleted

      - name: avg_deleted
        expression: $main.average($deleted)

      - name: unique_users
        title: Unique Users
        expression: $main.countDistinct($user)
