This repository contains all source code written in the context of helping the RBINS to publish its high-resolution beetles pictures to the OpenUP / Europeana_ project.
It consists of:
Required Python packages are listed in requirements.txt, install with:
::
$ pip install -r requirements.txt
The application requires the following environment variables to run:
DATABASE_URL # postgres://username:password@host:port/db_name
SECRET_KEY # http://www.miniwebtool.com/django-secret-key-generator/
GOOGLE_ANALYTICS_APP_NAME # Something like UA-XXXXXX
GOOGLE_ANALYTICS_USER_EMAIL
GOOGLE_ANALYTICS_USER_PASS
GOOGLE_ANALYTICS_TABLE_ID #something like ga:123456
To keep auto-reaload working:
::
$ foreman run python manage.py runserver 0.0.0.0:5000
OR to ensure same running details than on heroku:
::
$ foreman start
::
$ git push heroku master
$ python manage.py syncdb
The data import process takes as input:
And will output:
!!! Steps 1-3 are overly fragile and complex, but currently necessary as the CORRECT taxonomic data is not present in the Excel file and has to be extracted from file path/names !!! !!! Notes for rewriting this process (and the related data requirements can be found in data_import_tools/import_review.rst)
1) data_import_tools/imagestransformation/transform.rb resize the images, add overlays, some padding, ...
2) The Excel file and the result of an image directory "walk" are reconciled and imported in the "OpenUP" PostgreSQL database (will be consumed by BioCASE provider)
3) data_import_tools/images_transformation/step2/move_files.rb loop on the newly created rbinsphotos table, and for each row rename the associated image to
::
$ psql -h dev -U postgres -d openup_rbins
openup_rbins=# COPY (SELECT * FROM rbinsphotos) TO 'openup_export.csv' WITH CSV HEADER;
::
$ ./manage.py load_rbins_data data/openup_export.csv --truncate
.. _RBINS: http://www.naturalsciences.be/ .. _OpenUP: http://open-up.eu/ .. _Europeana: http://www.europeana.eu/ .. _BioCASE: http://www.biocase.org/ .. _Django: https://www.djangoproject.com/