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

some datapoint values in the response are wrong #16

Open
buchslava opened this issue Jan 31, 2018 · 1 comment
Open

some datapoint values in the response are wrong #16

buchslava opened this issue Jan 31, 2018 · 1 comment

Comments

@buchslava
Copy link
Contributor

dataset is SG
query is

{
        select: {
          key: ['geo', 'time'],
          value: [
            'life_expectancy_years', 'population_total'
          ]
        },
        from: 'datapoints',
        where: {
          $and: [
            {geo: '$geo'},
            {time: '$time'},
            {
              $or: [
                {population_total: {$gt: 10000}},
                {life_expectancy_years: {$gt: 30, $lt: 70}}
              ]
            }
          ]
        },
        join: {
          $geo: {
            key: 'geo',
            where: {
              $and: [
                {'is--country': true},
                {latitude: {$lte: 0}}
              ]
            }
          },
          $time: {
            key: 'time',
            where: {$and: [{time: {$gt: '1990', $lte: '2015'}}]}
          }
        },
        order_by: ['time', 'geo']
      }

or

http://waffle-server-dev.gapminderdev.org/api/ddf/ql?_select_key@=geo&=time;&value@=life/_expectancy/_years&=population/_total;;&from=datapoints&where_$and@_geo=$geo;&_time=$time;&_$or@_population/_total_$gt:10000;;&_life/_expectancy/_years_$gt:30&$lt:70;;;;;;&join_$geo_key=geo&where_$and@_is--country:true;&_latitude_$lte:0;;;;;&$time_key=time&where_$and@_time_$gt=1990&$lte=2015;;;;;;&order/_by@=time&=geo;&dataset=buchslava%252Freaders-test-ds-systema-globalis

result is (see ws.json)
screenshot from 2018-01-30 11-28-11

life_expectancy_years values should not be null

@buchslava buchslava changed the title some values in the response are wrong some datapoint values in the response are wrong Jan 31, 2018
@buchslava
Copy link
Contributor Author

buchslava commented Feb 1, 2018

The reason for the issue is due to WS functionality: WS does not support measure filter applying for the row. It supports filter applying for column (separate measure) only. Let me explain...

Imagine, we have next filter and next result for a dataset (datapoints selection):
Filter is empty {}
Result is

geo | time  | life_expectancy | population
arg  | 1991 | 72                      | 900000

An another case for same dataset:
Filter is { $or: [ {population_total: {$gt: 10000}}, {life_expectancy_years: {$gt: 30, $lt: 70}} ] }

Result for DDFCSV reader is

geo | time | life_expectancy | population
arg | 1991 | 72 | 900000

because 72>70 is false OR 90000>10000 is true -> result is true

Result for WS reader is

geo | time | life_expectancy | population
arg | 1991 | null                     | 900000

because WS applies the filter for each measure separately and merges result after that

I guess it's incorrect in accordance with https://docs.google.com/document/d/1olFm-XXjWxQ4LrTCfM42an6LbjbIgnt__V1DZxSmnuQ/edit# (Filter which affects which rows of the selection will be included in the response. This filter is a subset of MongoDB query operators)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant