#######################################
Commandes d'administration HDABo/HDALab
#######################################
Le projet HDA fournis un ensemble de commande d'administration permettant de maintenir l'état de l'application.
Ces commandes utilise le `système d'administration en ligne de commande de Django <https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/>`_.
L'usage des commande est en général le suivant:
```
django-admin <subcommand> [options] [arguments...]
```
Chaque commande implémente ses options et arguments.
Toutes les commandes du projet accèptent les options suivante:
- *\-\-version* : montre le numeero de version et quitte.
- *\-h, \-\-help* : montre le message d'aide et quitte.
- *\-v VERBOSITY, \-\-verbosity=VERBOSITY* : Niveau de verbosité; 0=minimal, 1=normal, 2=verbeux, 3=très verbeux
- *\-\-settings=SETTINGS* : Le chemin Python vers un module de `settings`. Si il n'est pas fourni, la variable d'environement DJANGO_SETTINGS_MODULE sera utilisée.
- *\-\-pythonpath=PYTHONPATH* : un répertoire à ajouter au chemins Python (`Python path <https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH>`_)
- *\-\-traceback* : Lève des exceptions `CommandError`.
- *\-\-no-color* : Ne colorise pas la sortie de la commande.
Les options spécifiques sont doumentées pour chaque commande.
Voici la liste des commandes hdalab:
- :ref:`commands-hdalab-calculate-preview`
- :ref:`commands-hdalab-export-tags-csv`
- :ref:`commands-hdalab-export-wpcategory-csv`
- :ref:`commands-hdalab-fill-tag-years`
- :ref:`commands-hdalab-geojson-transform`
- :ref:`commands-hdalab-import-hda-insee-csv`
- :ref:`commands-hdalab-import-hdabo-db`
- :ref:`commands-hdalab-import-insee-csv`
- :ref:`commands-hdalab-query-category-inclusion`
- :ref:`commands-hdalab-query-dbpedia`
- :ref:`commands-hdalab-query-geo-inclusion`
- :ref:`commands-hdalab-query-wikipedia-category`
- :ref:`commands-hdalab-send-moderation-mail`
et la liste des commandes hdabo:
- :ref:`commands-hdabo-clean-tags`
- :ref:`commands-hdabo-diff-csv`
- :ref:`commands-hdabo-import-csv`
- :ref:`commands-hdabo-import-rdf`
- :ref:`commands-hdabo-import-tag-popularity`
- :ref:`commands-hdabo-order-tags`
- :ref:`commands-hdabo-query-wikipedia`
Il est à noter que ce dans cette dernière liste seule la commande :ref:`commands-hdabo-import-rdf` est utilisée régulièrement pour importer les données HDA dans HDALab.
Commandes hdabo
===============
.. _commands-hdabo-clean-tags:
clean\_tags
-----------
.. automodule:: hdabo.management.commands.clean_tags
.. _commands-hdabo-diff-csv:
diff\_csv
---------
.. automodule:: hdabo.management.commands.diff_csv
.. _commands-hdabo-import-csv:
import\_csv
-----------
.. automodule:: hdabo.management.commands.import_csv
.. _commands-hdabo-import-rdf:
import\_rdf
-----------
.. automodule:: hdabo.management.commands.import_rdf
.. _commands-hdabo-import-tag-popularity:
import\_tag\_popularity
-----------------------
.. automodule:: hdabo.management.commands.import_tag_popularity
.. _commands-hdabo-order-tags:
order\_tags
-----------
.. automodule:: hdabo.management.commands.order_tags
.. _commands-hdabo-query-wikipedia:
query\_wikipedia
----------------
.. automodule:: hdabo.management.commands.query_wikipedia
Commandes hdalab
================
.. _commands-hdalab-calculate-preview:
calculate\_preview
------------------
.. automodule:: hdalab.management.commands.calculate_preview
.. _commands-hdalab-export-tags-csv:
export\_tags\_csv
-----------------
.. automodule:: hdalab.management.commands.export_tags_csv
.. _commands-hdalab-export-wpcategory-csv:
export\_wpcategory\_csv
-----------------------
.. automodule:: hdalab.management.commands.export_wpcategory_csv
.. _commands-hdalab-fill-tag-years:
fill\_tag\_years
----------------
.. automodule:: hdalab.management.commands.fill_tag_years
.. _commands-hdalab-geojson-transform:
geojson\_transform
------------------
.. automodule:: hdalab.management.commands.geojson_transform
.. _commands-hdalab-import-hda-insee-csv:
import\_hda\_insee\_csv
-----------------------
.. automodule:: hdalab.management.commands.import_hda_insee_csv
.. _commands-hdalab-import-hdabo-db:
import\_hdabo\_db
-----------------
.. automodule:: hdalab.management.commands.import_hdabo_db
.. _commands-hdalab-import-insee-csv:
import\_insee\_csv
------------------
.. automodule:: hdalab.management.commands.import_insee_csv
.. _commands-hdalab-query-category-inclusion:
query\_category\_inclusion
--------------------------
.. automodule:: hdalab.management.commands.query_category_inclusion
.. _commands-hdalab-query-dbpedia:
query\_dbpedia
--------------
.. automodule:: hdalab.management.commands.query_dbpedia
.. _commands-hdalab-query-geo-inclusion:
query\_geo\_inclusion
---------------------
.. automodule:: hdalab.management.commands.query_geo_inclusion
.. _commands-hdalab-query-wikipedia-category:
query\_wikipedia\_category
--------------------------
.. automodule:: hdalab.management.commands.query_wikipedia_category
.. _commands-hdalab-send-moderation-mail:
send\_moderation\_mail
----------------------
.. automodule:: hdalab.management.commands.send_moderation_mail
Import des données RDF HDA
==========================
La mise à jour des fiches HDA se fait par un process d'export/import des données.
Une archive RDF est régulièrement exportée à partir d'HDA et publiée sur une URL publique (http://data.culture.fr/entrepot/HDA/export.tgz).
Cette archive est alors régulièrement téléchargée et importée dans hdalab.
Le script d'import réalisant l'importation peut être trouvé dans le fichier suivant : ``/dev/hdalab/import_hda_rdf.sh``.
Ce script lance les commandes suivantes:
#. :class:`import_rdf <hdabo.management.commands.import_rdf>`
#. :class:`import_hdabo_db -c <hdalab.management.commands.import_hdabo_db>`
#. `rebuild_index <http://django-haystack.readthedocs.io/en/master/management_commands.html#rebuild-index>`_