django-francedata


Namedjango-francedata JSON
Version 0.16.2 PyPI version JSON
download
home_pagehttps://github.com/entrepreneur-interet-general/django-francedata
SummaryA Django app to provide a database structure, API and import scripts to manage French communes, intercommunalités, départements and régions, with their structure and data from Insee and the DGCL.
upload_time2023-01-11 19:46:24
maintainer
docs_urlNone
authorSylvain Boissel
requires_python>=3.8,<4.0
licenseAGPL-3
keywords django
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://badge.fury.io/py/django-francedata.svg
    :target: https://pypi.org/project/django-francedata/

.. image:: https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/django.yml/badge.svg
    :target: https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/django.yml

.. image:: https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/codeql-analysis.yml/badge.svg
    :target: https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/codeql-analysis.yml


=================
Django-Francedata
=================

Provides a database structure, API and import scripts to manage French communes, intercommunalités, départements and régions, with their structure and data from Insee and the DGCL.

This app was created as a part of `Open Collectivités <https://github.com/entrepreneur-interet-general/opencollectivites>`_.

Unaccent extension
##################

If the PostgreSQL user specified in the Django settings is not a superuser, connect to the postgres user and create the Unaccent extension manually::

    psql
    \c <dbname>
    "CREATE EXTENSION  IF NOT EXISTS unaccent;"

Quickstart
##########

1. Add "francedata" to your INSTALLED_APPS setting like this::

    INSTALLED_APPS = [
        ...
        "django_json_widget",
        "simple_history",
        "francedata",
    ]

2. Run ``python manage.py migrate`` to create the francedata models.

3. Run the two initialization commands to get the communes, EPCIs, départements and régions structure::

    python manage.py cog_import
    python manage.py banatic_import

4. Visit http://127.0.0.1:8000/admin/ to see the data.
  
Commands
########

cog_import:
***********

* goal: load the following data from the Code officiel géographique (COG): list of regions, departements and communes, with how they are linked and:
  * insee and siren ids for the regions/departements
  * insee for the communes
* parameters:
  * --level: partial import of only the specified level (the script expects the higher ones to already be installed) Allowed values: `regions`, `departements`, `communes`
  * --years: import the specified year (min: 2019), by default it imports the latest available one in https://www.data.gouv.fr/fr/datasets/code-officiel-geographique-cog/

banatic_import:
***************

* goal: load the following data from the Banatic:
  * siren ids and population data for the communes
  * insee for the communes
* The script expects that `cog_import` was already run and that the communes level is passed before the epci level.
* parameters:
  * --level: partial import of only the specified level. Allowed values: `communes`, `epci`
  * --years: import the specified year (min: 2019 for the communes level (data is taken from the file `Table de correspondance code SIREN / Code Insee des communes` from https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/fichiers-telech.php ), by default it imports the latest available one)
* warning: The epci level only works for the current year (data is taken from https://www.data.gouv.fr/fr/datasets/base-nationale-sur-les-intercommunalites/ )

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/entrepreneur-interet-general/django-francedata",
    "name": "django-francedata",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "django",
    "author": "Sylvain Boissel",
    "author_email": "sylvain.boissel@beta.gouv.fr",
    "download_url": "https://files.pythonhosted.org/packages/fc/8e/a12f2762be8578d62adae22af9159feaf3efc3acf29038043f429e8c2ce0/django_francedata-0.16.2.tar.gz",
    "platform": null,
    "description": ".. image:: https://badge.fury.io/py/django-francedata.svg\n    :target: https://pypi.org/project/django-francedata/\n\n.. image:: https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/django.yml/badge.svg\n    :target: https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/django.yml\n\n.. image:: https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/codeql-analysis.yml/badge.svg\n    :target: https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/codeql-analysis.yml\n\n\n=================\nDjango-Francedata\n=================\n\nProvides a database structure, API and import scripts to manage French communes, intercommunalit\u00e9s, d\u00e9partements and r\u00e9gions, with their structure and data from Insee and the DGCL.\n\nThis app was created as a part of `Open Collectivit\u00e9s <https://github.com/entrepreneur-interet-general/opencollectivites>`_.\n\nUnaccent extension\n##################\n\nIf the PostgreSQL user specified in the Django settings is not a superuser, connect to the postgres user and create the Unaccent extension manually::\n\n    psql\n    \\c <dbname>\n    \"CREATE EXTENSION  IF NOT EXISTS unaccent;\"\n\nQuickstart\n##########\n\n1. Add \"francedata\" to your INSTALLED_APPS setting like this::\n\n    INSTALLED_APPS = [\n        ...\n        \"django_json_widget\",\n        \"simple_history\",\n        \"francedata\",\n    ]\n\n2. Run ``python manage.py migrate`` to create the francedata models.\n\n3. Run the two initialization commands to get the communes, EPCIs, d\u00e9partements and r\u00e9gions structure::\n\n    python manage.py cog_import\n    python manage.py banatic_import\n\n4. Visit http://127.0.0.1:8000/admin/ to see the data.\n  \nCommands\n########\n\ncog_import:\n***********\n\n* goal: load the following data from the Code officiel g\u00e9ographique (COG): list of regions, departements and communes, with how they are linked and:\n  * insee and siren ids for the regions/departements\n  * insee for the communes\n* parameters:\n  * --level: partial import of only the specified level (the script expects the higher ones to already be installed) Allowed values: `regions`, `departements`, `communes`\n  * --years: import the specified year (min: 2019), by default it imports the latest available one in https://www.data.gouv.fr/fr/datasets/code-officiel-geographique-cog/\n\nbanatic_import:\n***************\n\n* goal: load the following data from the Banatic:\n  * siren ids and population data for the communes\n  * insee for the communes\n* The script expects that `cog_import` was already run and that the communes level is passed before the epci level.\n* parameters:\n  * --level: partial import of only the specified level. Allowed values: `communes`, `epci`\n  * --years: import the specified year (min: 2019 for the communes level (data is taken from the file `Table de correspondance code SIREN / Code Insee des communes` from https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/fichiers-telech.php ), by default it imports the latest available one)\n* warning: The epci level only works for the current year (data is taken from https://www.data.gouv.fr/fr/datasets/base-nationale-sur-les-intercommunalites/ )\n",
    "bugtrack_url": null,
    "license": "AGPL-3",
    "summary": "A Django app to provide a database structure, API and import scripts to manage French communes, intercommunalit\u00e9s, d\u00e9partements and r\u00e9gions, with their structure and data from Insee and the DGCL.",
    "version": "0.16.2",
    "split_keywords": [
        "django"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3ba15b11971a51978b53dae3e4c3e693492ff482d73091fa2af4df2524f45ab1",
                "md5": "8a378213f0a43defc6b7f01942220cea",
                "sha256": "9584745544679a94fbc60e120f770fef1dc5522e1cfaf779e9da5e5c6298115f"
            },
            "downloads": -1,
            "filename": "django_francedata-0.16.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8a378213f0a43defc6b7f01942220cea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 89577,
            "upload_time": "2023-01-11T19:46:23",
            "upload_time_iso_8601": "2023-01-11T19:46:23.539780Z",
            "url": "https://files.pythonhosted.org/packages/3b/a1/5b11971a51978b53dae3e4c3e693492ff482d73091fa2af4df2524f45ab1/django_francedata-0.16.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc8ea12f2762be8578d62adae22af9159feaf3efc3acf29038043f429e8c2ce0",
                "md5": "1d412320fe504df01e2642fd3367e74b",
                "sha256": "56e1c3c0ad492631ad6b3e9fe487ec99cc81fe065b20c1d96b82bfbaf331d970"
            },
            "downloads": -1,
            "filename": "django_francedata-0.16.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1d412320fe504df01e2642fd3367e74b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 65927,
            "upload_time": "2023-01-11T19:46:24",
            "upload_time_iso_8601": "2023-01-11T19:46:24.950988Z",
            "url": "https://files.pythonhosted.org/packages/fc/8e/a12f2762be8578d62adae22af9159feaf3efc3acf29038043f429e8c2ce0/django_francedata-0.16.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-11 19:46:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "entrepreneur-interet-general",
    "github_project": "django-francedata",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-francedata"
}
        
Elapsed time: 0.06861s