This is an ambitious project to project a wrapper layer on top of the Armenian NSS data sources. We use Python to download all the data that the NSS provides, clean it up and store it in our sqlite database, then with that data we expose it to a beautiful front end with React, d3.
You'll need to have Python
installed, we are using
Python3
. Assuming you are on Debian
based distribution, aka
Debian
or Ubuntu
, then you do:
$ sudo aptitude install python3-pip -y
Then I recommend you update pip3
itself with pip3 install --upgrade pip
To install the Python
requirements, you'll need to run $ npm run pyrequire
. If you look in the requirements.txt
file you'll see two
pacakges, one is requests
, we will use that for HTTP
requests and
the other is xlrd
, this is a package to read and handle Excel
files.
Now you need to have the node
part of the project working, for that
just do
$ npm install
You'll need to have some system requirements, primarily for our
sqlite3 database. For this project you can version control a junk
database under junk
, to make it easier for testing and debugging the
code when not in a production environment.
Get sqlite with aptitude
, as always: aptitude install sqlite
.
If you're working on the JavaScript
part of the project, then you
need to open a shell and just run npm run watch
, and that will:
- Restart the server when there's a change in backend code.
- Recompile the front end code whenever there is a
JSX
change. - Bundle the code up for the front end
The project is divided into tasks that reflect the pipeline of the whole application.
Roughly:
- Download the data from
ArmStat
/NSS
. - Clean up the data for a format suitable for an insert query to our sqlite database.
- Do this periodically, can do it as a cron job or systemd job, I prefer systemd.
- node now needs to provide a layer on top of this database. Use
express
to create a niceREST
API. Keep in mind that thisREST
API must be well made insofar as that we want to have unique graphs created by the user be recreatable by URL. UseReact
router on the serverside for this, examples in silicondzor. - Front end
React
provides a skeletion as an application box, handling events, UX, etc. d3
add the great UI effect of graphs that tell a story and narrative.