Purgeable / full-app

Keep all functionality for (parsers + db + frontend API) inside one Django project.
0 stars 1 forks source link

search-filter-order methods example #8

Closed epogrebnyak closed 6 years ago

epogrebnyak commented 7 years ago

Likely will need a different view series and serialisation readable by pd.read_json ().

Need a better mock database - will post some more output from parsers.

epogrebnyak commented 7 years ago

From datapoints view must show we can query datapoints by name, freq, and date range.

tinivir commented 7 years ago

@epogrebnyak I'll add 3 method:

  1. search like /datapoint/?search=testname
  2. filtering /datapoint/?name=test1&date=2017-01-01
  3. ordering /datapoint/?ordering=-name
epogrebnyak commented 7 years ago

Let me think on how to change this, perhaps just one method

epogrebnyak commented 7 years ago

@tinivir :

The method we need here is the following:

datapoint/?name=BRENT&freq=d
datapoint/?name=BRENT&freq=d&start_date=2017-01-01
datapoint/?name=BRENT&freq=d&start_date=2017-01-01&end_date=2017-06-01

What is search method you mentioned in (1)? It is not to implement now, just interested what it retruns.

tinivir commented 7 years ago

First is simple search on fields we defined. Django has 3 components for this 3 methods:

  1. search - SearchFilter
  2. filtering - DjangoFilterBackend
  3. ordering - OrderingFilter

You can look up here for them: http://www.django-rest-framework.org/api-guide/filtering/ I'll add all 3 of them. Maybe we'll need search in future

epogrebnyak commented 7 years ago

@tinivir - what is the state of this task? can you please provide URLs/instructions for methods mentioned? Are they covered by tests (both yes and no are, ok - just to know wetre we are).

epogrebnyak commented 7 years ago

@tinivir: I need some writing here please where to go to check if/how it is done.

@tinivir - what is the state of this task? can you please provide URLs/instructions for methods mentioned? Are they covered by tests (both yes and no are, ok - just to know wetre we are).

tinivir commented 6 years ago

@epogrebnyak you can just review my commit I added to this issue to see what changes I made. I added 3 tests in datapoint/tests.py: test_search test_filter test_order And for now I think that's all.