Commit db718593 authored by Maarten van der Veen's avatar Maarten van der Veen

line endings

parent 605c59de
{ {
"directory" : "src/web/static/lib" "directory" : "src/web/static/lib"
} }
# use glob syntax # use glob syntax
syntax: glob syntax: glob
*.elc *.elc
*.pyc *.pyc
*~ *~
*.db *.db
# Emacs # Emacs
eproject.cfg eproject.cfg
# Temporary files (vim backups) # Temporary files (vim backups)
*.swp *.swp
# Log files: # Log files:
*.log *.log
# Vagrant: # Vagrant:
.vagrant/ .vagrant/
# Virtualenv # Virtualenv
venv venv
build build
# bower # bower
src/web/static/lib/* src/web/static/lib/*
!src/web/static/lib/leaflet !src/web/static/lib/leaflet
!src/web/static/lib/dc !src/web/static/lib/dc
!src/web/static/lib/file-saver !src/web/static/lib/file-saver
!src/web/static/lib/bootstrap-slider !src/web/static/lib/bootstrap-slider
# node files # node files
node_modules node_modules
.coverage .coverage
documentation/_build/ documentation/_build/
src/conf/conf.cfg src/conf/conf.cfg
src/web/public/ src/web/public/
# pycharm # pycharm
.idea/ .idea/
Cédric Bonhomme <cedric@cedricbonhomme.org>, Luxembourg Institute of Science and Technology Cédric Bonhomme <cedric@cedricbonhomme.org>, Luxembourg Institute of Science and Technology
Damien Nicolas <damien.nicolas@list.lu>, Luxembourg Institute of Science and Technology Damien Nicolas <damien.nicolas@list.lu>, Luxembourg Institute of Science and Technology
Shelter Database project news Shelter Database project news
0.1 (2015-03-30) 0.1 (2015-03-30)
- initial release. - initial release.
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2016 CHARISM Copyright (c) 2016 CHARISM
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
Shelter Database Shelter Database
================ ================
# Presentation # Presentation
The goal of this application is to list the shelters deployed around the world. The goal of this application is to list the shelters deployed around the world.
The official instance is available [here](https://shelter-database.org). The official instance is available [here](https://shelter-database.org).
Read the [documentation](https://git.list.lu/charism/shelter-database/tree/master/documentation) Read the [documentation](https://git.list.lu/charism/shelter-database/tree/master/documentation)
for information about the deployment of the application. for information about the deployment of the application.
# Documentation # Documentation
To generate the documentation in HTML format: To generate the documentation in HTML format:
./documentation$ sudo pip install sphinx ./documentation$ sudo pip install sphinx
./documentation$ make html ./documentation$ make html
The result will be in the *_build* folder. The result will be in the *_build* folder.
# License # License
This application is under MIT license. This application is under MIT license.
# Contact # Contact
[Luxembourg Institute of Science and Technology](http://www.list.lu) [Luxembourg Institute of Science and Technology](http://www.list.lu)
{ {
"name": "shelter-database", "name": "shelter-database",
"version": "0.0.2", "version": "0.0.2",
"authors": [ "authors": [
"Cédric Bonhomme <cedric.bonhomme@list.lu>", "Cédric Bonhomme <cedric.bonhomme@list.lu>",
"Maarten van der Veen <mvanderveen@redcross.nl>" "Maarten van der Veen <mvanderveen@redcross.nl>"
], ],
"license": "MIT", "license": "MIT",
"ignore": [ "ignore": [
"**/.*" "**/.*"
], ],
"dependencies": { "dependencies": {
"jquery": "~1.11.3", "jquery": "~1.11.3",
"bootstrap-select": "~1.7.5", "bootstrap-select": "~1.7.5",
"bootstrap": "~3.3.6", "bootstrap": "~3.3.6",
"font-awesome": "4.6.3", "font-awesome": "4.6.3",
"datatables.net": "~1.10.10", "datatables.net": "~1.10.10",
"datatables.net-bs": "~1.10.10", "datatables.net-bs": "~1.10.10",
"tinymce": "^4.3.12", "tinymce": "^4.3.12",
"bootstrap-datepicker": "^1.6.1", "bootstrap-datepicker": "^1.6.1",
"lightbox2": "lightbox#^2.8.2" "lightbox2": "lightbox#^2.8.2"
} }
} }
<p><span style="font-size: medium;">Hundreds of thousands of shelters are built throughout the world every year in response to disasters, by a multitude of shelter actors. </span></p> <p><span style="font-size: medium;">Hundreds of thousands of shelters are built throughout the world every year in response to disasters, by a multitude of shelter actors. </span></p>
<p><span style="font-size: medium;">Confronted with the reality of rising numbers of disasters where sheltering presents a key component of the humanitarian assistance the Humanitarian Shelter Sector is challenged to deliver more, efficient and sustainable responses in very different contexts. </span></p> <p><span style="font-size: medium;">Confronted with the reality of rising numbers of disasters where sheltering presents a key component of the humanitarian assistance the Humanitarian Shelter Sector is challenged to deliver more, efficient and sustainable responses in very different contexts. </span></p>
<p><span style="font-size: medium;">Within the Red Cross Movement and other Organisations active in sheltering there exists extensive experience in the implementation of emergency, transitional and permanent shelters.</span></p> <p><span style="font-size: medium;">Within the Red Cross Movement and other Organisations active in sheltering there exists extensive experience in the implementation of emergency, transitional and permanent shelters.</span></p>
<p><span style="font-size: medium;">To consolidate and make available this knowledge the IFRC-SRU is tasked to build up an inventory of shelter solutions documented in a systematic, methodological manner that particularly captures technical details, construction practices, climatic conditions, availability and suitability of materials and techniques and other information for the planning process that helps save time and resources.</span></p> <p><span style="font-size: medium;">To consolidate and make available this knowledge the IFRC-SRU is tasked to build up an inventory of shelter solutions documented in a systematic, methodological manner that particularly captures technical details, construction practices, climatic conditions, availability and suitability of materials and techniques and other information for the planning process that helps save time and resources.</span></p>
<p><span style="font-size: medium;">The Shelter Database is conceived to be a resource for the wider shelter sector, that can help to deliver humanitarian shelter more time- and cost efficient and better adapted to the respective context. The collected data can also serve for technical analysis as well as longer term evaluation of shelter solutions and to identify and share best practices.<br /> The IFRC-SRU has the ambition to systematically map shelter projects in responses where the Shelter Cluster was activated and led by IFRC, however we invite all shelter actors to participate in building up this resource by entering their shelter project using the online format (to enter a shelter, create your profile under &#8220;join&#8221;).</span></p> <p><span style="font-size: medium;">The Shelter Database is conceived to be a resource for the wider shelter sector, that can help to deliver humanitarian shelter more time- and cost efficient and better adapted to the respective context. The collected data can also serve for technical analysis as well as longer term evaluation of shelter solutions and to identify and share best practices.<br /> The IFRC-SRU has the ambition to systematically map shelter projects in responses where the Shelter Cluster was activated and led by IFRC, however we invite all shelter actors to participate in building up this resource by entering their shelter project using the online format (to enter a shelter, create your profile under &#8220;join&#8221;).</span></p>
<p><strong>Please Note: this is work in progress, any comments and corrections are most welcome. Please contact us under <a href="mailto:ifrc-sru@croix-rouge.lu">ifrc-sru@croix-rouge.lu</a></strong></p> <p><strong>Please Note: this is work in progress, any comments and corrections are most welcome. Please contact us under <a href="mailto:ifrc-sru@croix-rouge.lu">ifrc-sru@croix-rouge.lu</a></strong></p>
\ No newline at end of file
<p><span style="font-size: medium;">Des centaines de milliers d'abris sont construits à travers le monde chaque année en réponse aux catastrophes, par une multitude d'acteurs du logement.</span></p> <p><span style="font-size: medium;">Des centaines de milliers d'abris sont construits à travers le monde chaque année en réponse aux catastrophes, par une multitude d'acteurs du logement.</span></p>
<p><span style="font-size: medium;">Face à la réalité du nombre croissant de catastrophes où le recouvrement présente une composante clé de l'aide humanitaire du secteur du logement humanitaire est mis au défi de fournir plus de réponses, efficaces et durables dans des contextes très différents.</span></p> <p><span style="font-size: medium;">Face à la réalité du nombre croissant de catastrophes où le recouvrement présente une composante clé de l'aide humanitaire du secteur du logement humanitaire est mis au défi de fournir plus de réponses, efficaces et durables dans des contextes très différents.</span></p>
<p><span style="font-size: medium;">Dans le Mouvement de la Croix-Rouge et d'autres organisations actives dans l'abri, il existe une vaste expérience dans la mise en œuvre d'urgence, de transition et des abris permanents.</span></p> <p><span style="font-size: medium;">Dans le Mouvement de la Croix-Rouge et d'autres organisations actives dans l'abri, il existe une vaste expérience dans la mise en œuvre d'urgence, de transition et des abris permanents.</span></p>
<p><span style="font-size: medium;">Pour consolider et mettre à la disposition de cette connaissance la FICR-SRU est chargé de mettre en place un inventaire des solutions d'hébergement documentés d'une manière méthodologique systématique qui capte particulièrement les détails techniques, les pratiques de construction, les conditions climatiques, la disponibilité et les qualités des matériaux et des techniques et d'autres informations pour le processus de planification qui permet d'économiser du temps et des ressources.</span></p> <p><span style="font-size: medium;">Pour consolider et mettre à la disposition de cette connaissance la FICR-SRU est chargé de mettre en place un inventaire des solutions d'hébergement documentés d'une manière méthodologique systématique qui capte particulièrement les détails techniques, les pratiques de construction, les conditions climatiques, la disponibilité et les qualités des matériaux et des techniques et d'autres informations pour le processus de planification qui permet d'économiser du temps et des ressources.</span></p>
<p><span style="font-size: medium;">La base de données de Shelter est conçu pour être une ressource pour le secteur du logement plus large, qui peut aider à fournir un abri humanitaire plus de temps et de coûts efficace et mieux adaptée au contexte respectif. Les données recueillies peuvent également servir à l'analyse technique ainsi que évaluation à long terme des solutions d'hébergement et d'identifier et de partager les meilleures pratiques.</span></p> <p><span style="font-size: medium;">La base de données de Shelter est conçu pour être une ressource pour le secteur du logement plus large, qui peut aider à fournir un abri humanitaire plus de temps et de coûts efficace et mieux adaptée au contexte respectif. Les données recueillies peuvent également servir à l'analyse technique ainsi que évaluation à long terme des solutions d'hébergement et d'identifier et de partager les meilleures pratiques.</span></p>
<p><span style="font-size: medium;">La FICR-SRU a l'ambition de cartographier systématiquement les projets de logement dans les réponses où le Shelter Cluster a été activé et dirigé par la FICR, mais nous invitons tous les acteurs du logement pour participer à la construction de cette ressource en entrant leur projet d'abris en utilisant le format en ligne (pour entrer un abri, créez votre profil sous "join").</span></p> <p><span style="font-size: medium;">La FICR-SRU a l'ambition de cartographier systématiquement les projets de logement dans les réponses où le Shelter Cluster a été activé et dirigé par la FICR, mais nous invitons tous les acteurs du logement pour participer à la construction de cette ressource en entrant leur projet d'abris en utilisant le format en ligne (pour entrer un abri, créez votre profil sous "join").</span></p>
<p><span style="font-size: medium;">S'il vous plaît noter: ce travail est en cours, tous les commentaires et corrections sont les bienvenues. S'il vous plaît nous contacter sous <a href="mailto:ifrc-sru@croix-rouge.lu">ifrc-sru@croix-rouge.lu</a></span></p> <p><span style="font-size: medium;">S'il vous plaît noter: ce travail est en cours, tous les commentaires et corrections sont les bienvenues. S'il vous plaît nous contacter sous <a href="mailto:ifrc-sru@croix-rouge.lu">ifrc-sru@croix-rouge.lu</a></span></p>
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Web Services Web Services
============ ============
Example of requests to the Web Service Example of requests to the Web Service
-------------------------------------- --------------------------------------
.. code-block:: shell .. code-block:: shell
# Get the list of root categories # Get the list of root categories
$ GET http://127.0.0.1:5000/api/category?q={"filters":[{"name":"parent_id","op":"is_null"}]} $ GET http://127.0.0.1:5000/api/category?q={"filters":[{"name":"parent_id","op":"is_null"}]}
# Get the list of child categories # Get the list of child categories
$ GET http://127.0.0.1:5000/api/category?q={"filters":[{"name":"parent_id","op":"is_not_null"}]} $ GET http://127.0.0.1:5000/api/category?q={"filters":[{"name":"parent_id","op":"is_not_null"}]}
# Get information about the child category "Walls & Frame" # Get information about the child category "Walls & Frame"
$ GET http://127.0.0.1:5000/api/category?q={"filters":[{"name":"parent_id","op":"is_not_null"},{"name":"name","op":"eq","val":"Walls %26 frame"}]} $ GET http://127.0.0.1:5000/api/category?q={"filters":[{"name":"parent_id","op":"is_not_null"},{"name":"name","op":"eq","val":"Walls %26 frame"}]}
# Get information about an attribute # Get information about an attribute
$ GET http://127.0.0.1:5000/api/attribute?q={"filters":[{"name":"name","op":"eq","val":"Landform"}]} $ GET http://127.0.0.1:5000/api/attribute?q={"filters":[{"name":"name","op":"eq","val":"Landform"}]}
$ GET http://127.0.0.1:5000/api/attribute?q={"filters":[{"name":"name","op":"eq","val":"Main hazards in country"}]} $ GET http://127.0.0.1:5000/api/attribute?q={"filters":[{"name":"name","op":"eq","val":"Main hazards in country"}]}
# Get the translations of a string # Get the translations of a string
$ GET http://127.0.0.1:5000/api/translation?q={"filters":[{"name":"original","op":"eq","val":"Name of shelter"}]} $ GET http://127.0.0.1:5000/api/translation?q={"filters":[{"name":"original","op":"eq","val":"Name of shelter"}]}
Web Services Web Services
============ ============
Usage of the development API v0.1 Usage of the development API v0.1
--------------------------------- ---------------------------------
request parameters: request parameters:
**attribute**: pass one or more attribute names, such as `<attribute=Name,Vegetation>` **attribute**: pass one or more attribute names, such as `<attribute=Name,Vegetation>`
NOTE: Currently the attribute names may contain capital letters and spaces. NOTE: Currently the attribute names may contain capital letters and spaces.
Spaces should be substituted as `<%20>` int the URL, for example Spaces should be substituted as `<%20>` int the URL, for example
`<Climate%20Zone>`. An alternative "coding-friendly" attribute naming will be implemented shortly, `<Climate%20Zone>`. An alternative "coding-friendly" attribute naming will be implemented shortly,
as unique strings for each attribute whithout spaces and upper case letters. as unique strings for each attribute whithout spaces and upper case letters.
**format**: use `<format=prettytext>` to get the nicely formatted attribute names in the JSON, **format**: use `<format=prettytext>` to get the nicely formatted attribute names in the JSON,
instead of the "coding-friendly" attribute names. instead of the "coding-friendly" attribute names.
Examples: Examples:
.. code-block:: shell .. code-block:: shell
http://0.0.0.0:5000/api/v0.1 http://0.0.0.0:5000/api/v0.1
# Welcome message and version info # Welcome message and version info
http://0.0.0.0:5000/api/v0.1/shelters http://0.0.0.0:5000/api/v0.1/shelters
# Get all shelters and their attributes # Get all shelters and their attributes
http://0.0.0.0:5000/api/v0.1/shelters/3 http://0.0.0.0:5000/api/v0.1/shelters/3
# Get a specific shelter via shelter ID # Get a specific shelter via shelter ID
http://0.0.0.0:5000/api/v0.1/shelters?attribute=Vegetation http://0.0.0.0:5000/api/v0.1/shelters?attribute=Vegetation
# Get all shelters which have an atttribute value for "Vegetation" # Get all shelters which have an atttribute value for "Vegetation"
http://0.0.0.0:5000/api/v0.1/shelters?attribute=vegetation&format=prettytext http://0.0.0.0:5000/api/v0.1/shelters?attribute=vegetation&format=prettytext
# Get all shelters which have an atttribute value for "Vegetation", with nicely formatted attribute names # Get all shelters which have an atttribute value for "Vegetation", with nicely formatted attribute names
http://0.0.0.0:5000/api/v0.1/attributes/Climate zone http://0.0.0.0:5000/api/v0.1/attributes/Climate zone
# Get all available values of an attribute # Get all available values of an attribute
http://0.0.0.0:5000/api/v0.1/shelters/Kitchen type http://0.0.0.0:5000/api/v0.1/shelters/Kitchen type
#get all shelters which have a specific attribute #get all shelters which have a specific attribute
http://0.0.0.0:5000/api/v0.1/shelters/Kitchen type/open fire http://0.0.0.0:5000/api/v0.1/shelters/Kitchen type/open fire
#get all shelters which have a specific attribute value #get all shelters which have a specific attribute value
This diff is collapsed.
Database migrations Database migrations
=================== ===================
Add a new migration script Add a new migration script
-------------------------- --------------------------
.. code-block:: shell .. code-block:: shell
python3.5 src/manager.py db revision -m "comment about the changes" python3.5 src/manager.py db revision -m "comment about the changes"
Then edit appropriately the generated file. Then edit appropriately the generated file.
Update the database to the last version Update the database to the last version
--------------------------------------- ---------------------------------------
.. code-block:: shell .. code-block:: shell
python3.5 src/manager.py db upgrade python3.5 src/manager.py db upgrade
See the history of the migrations on the current database See the history of the migrations on the current database
--------------------------------------------------------- ---------------------------------------------------------
.. code-block:: shell .. code-block:: shell
python3.5 src/manager.py db history python3.5 src/manager.py db history
Database schema Database schema
=============== ===============
.. figure:: _static/uml_graph.png .. figure:: _static/uml_graph.png
:align: center :align: center
Database diagram Database diagram
This diff is collapsed.
This diff is collapsed.
.. Shelter Database documentation master file, created by .. Shelter Database documentation master file, created by
sphinx-quickstart on Sun Jun 19 21:53:46 2016. sphinx-quickstart on Sun Jun 19 21:53:46 2016.
You can adapt this file completely to your liking, but it should at least You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive. contain the root `toctree` directive.
Presentation Presentation
============ ============
The goal of this application is to list the shelters deployed around the world. The goal of this application is to list the shelters deployed around the world.
The official instance is available `here <https://shelter-database.org>`_. The official instance is available `here <https://shelter-database.org>`_.
Deployment Deployment
========== ==========
.. toctree:: .. toctree::
:maxdepth: 3 :maxdepth: 3
deployment deployment
pdf-generation pdf-generation
test-server test-server
Database Database
======== ========
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
database-schema database-schema
database-migrations database-migrations
Web Services Web Services
============ ============
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
api api
This diff is collapsed.
PDF generation PDF generation
============== ==============
If you want to enable the generation of PDF you will need to install the If you want to enable the generation of PDF you will need to install the
following requirements. following requirements.
Requirements Requirements
------------ ------------
.. code-block:: shell .. code-block:: shell
sudo apt-get install libxml2-dev libxslt-dev libcairo-dev libffi-dev libpango1.0-dev sudo apt-get install libxml2-dev libxslt-dev libcairo-dev libffi-dev libpango1.0-dev
# to include JPEG images in PDF files # to include JPEG images in PDF files
sudo apt-get install libgdk-pixbuf2.0-dev sudo apt-get install libgdk-pixbuf2.0-dev
sudo pip3.5 install cairocffi weasyprint sudo pip3.5 install cairocffi weasyprint
This diff is collapsed.
#! /usr/bin/env sh #! /usr/bin/env sh
# drop completely the db (with the sequences) # drop completely the db (with the sequences)
sudo -u postgres dropdb shelter sudo -u postgres dropdb shelter
sudo -u postgres createdb shelter --no-password sudo -u postgres createdb shelter --no-password
echo "ALTER USER pgsqluser WITH ENCRYPTED PASSWORD 'pgsqlpwd';" | sudo -u postgres psql echo "ALTER USER pgsqluser WITH ENCRYPTED PASSWORD 'pgsqlpwd';" | sudo -u postgres psql
echo "GRANT ALL PRIVILEGES ON DATABASE shelter TO pgsqluser;" | sudo -u postgres psql echo "GRANT ALL PRIVILEGES ON DATABASE shelter TO pgsqluser;" | sudo -u postgres psql
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
from .login import LoginForm, SignupForm from .login import LoginForm, SignupForm
from .profile import ProfileForm from .profile import ProfileForm
from .user_form import CreateUserForm, EditUserForm from .user_form import CreateUserForm, EditUserForm
from .category import CategoryForm from .category import CategoryForm
from .attribute import AttributeForm from .attribute import AttributeForm