Datafable/epu-index

Changes to EPU endpoint

Closed this issue · 5 comments

Here's how I would change the EPU endpoint to serve for the charts (#2) as well as the downloads (#12):

Options

format=json or format=csv
start_date=yyyy-mm-dd
end_date=yyyy-mm-dd

Changes:

  • The csv option would replace http://epu-index.herokuapp.com/epu-csv, which currently doesn't offer the possibility to get data for a date range (which is a requirement by the client).
  • Use start_date and end_date instead of less clear start and end (especially since we'll have another endpoint with just date)

Results

[
    {
        "date": "2002-04-02",
        "epu": 3.141592,
        "number_of_newspapers": 3,
        "number_of_articles": 14
    },
    {
    }
]

Changes:

  • Results should be returned in chronological order. This is very helpful for csv downloads and nice to have for json.
  • number_of_newspapers, number_of_articles are required for csv download, and nice to have for json.
  • number_of_papers is renamed to number_of_newspapers to avoid confusion with scientific "papers"
  • id is dropped

@bartaelterman can you review and assign to @niconoe when OK.

Agreed.

Hi guys, that should be it! Please test the new API (at https://epu-index.herokuapp.com/api/epu/) and report any issue or close this ticket.

I tested it. Looks perfect.

@peterdesmet will you give it a final look and close this ticket?

Great, thanks!