Skip to content
Retrieve and hold data from eurostat's API
JavaScript HTML
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dev v1
js v1.1
.gitignore v1
LICENSE v1
README.md v1
bower.json v1
index.html v1.1
test1.html v1
test2.html v1

README.md

eurostatDb.js

Retrieve and store data from eurostat's API.

Eurostat provides a wealth of information -- it's just pretty hard to get to and use. It provides the data over its API in a very 'rich' xml format that is a bit too overwhelming for many uses. This library aims at making things easier for use in javascript web applications.

I promise

The code has been rewritten to use promises instead of callbacks, so that there are now 2 versions:

  • v0: (deprecated) uses callbacks
  • v1: uses promises

There is no compatibility between the versions. The use of v1+ is encouraged.

Sample use

v1 (current):

db = eurostatDb();
db.tblQinit("demo_pjan", {FREQ: "A", AGE: "TOTAL"}, {startYear: 1995, endYear: 2015}); //1
db.rstQ("demo_pjan", {SEX: "T", GEO: "NL"}, "TIME ASEC") //2
    .then(function (rst) {
        $("div#info").prepend("<h2>Total population in the Netherlands:</h2>");
        rst.forEach(function (r) {$("ul").append("<li>In " + r.TIME + ": " + r.OBS_VALUE + "</li>");});//3
    })
    .catch(function (e) {alert(e);});

Resulting web page, and other examples, are found in the wiki pages. Check it out!

Reference

Found in the wiki's library reference.

Dependencies

eurostatDb.js depends on

so be sure to include those.

Also, the file all_latest_ESTAT_references=none_detail=full.xml which contains the dataflow names and descriptions, must be located in the js/ directory.

Bower

Package is named eurostat-db.

Include the file eurostatDb.js in your project, and be sure to move/copy the file all_latest_ESTAT_references=none_detail=full.xml into your project's js/ directory as mentioned above.

Suggestions

I'm always interested in feedback and suggestions. Please let me know what you think is good, or what could be better. Thanks!

Something went wrong with that request. Please try again.