{"id":16930321,"url":"https://github.com/pdelboca/django-dcat","last_synced_at":"2025-03-22T11:31:18.891Z","repository":{"id":212050562,"uuid":"729896176","full_name":"pdelboca/django-dcat","owner":"pdelboca","description":"A django application that implements a model layer to work with DCAT.","archived":false,"fork":false,"pushed_at":"2024-11-27T09:47:54.000Z","size":57,"stargazers_count":8,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-14T18:54:50.179Z","etag":null,"topics":["data-portal","dcat","dcat-ap","open-data"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pdelboca.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-10T17:26:39.000Z","updated_at":"2024-11-27T09:47:58.000Z","dependencies_parsed_at":"2023-12-15T13:41:15.095Z","dependency_job_id":"d16cf934-d079-4e7b-be81-6faa67366648","html_url":"https://github.com/pdelboca/django-dcat","commit_stats":null,"previous_names":["pdelboca/django-dcat"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdelboca%2Fdjango-dcat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdelboca%2Fdjango-dcat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdelboca%2Fdjango-dcat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdelboca%2Fdjango-dcat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdelboca","download_url":"https://codeload.github.com/pdelboca/django-dcat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244951418,"owners_count":20537384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-portal","dcat","dcat-ap","open-data"],"created_at":"2024-10-13T20:41:24.060Z","updated_at":"2025-03-22T11:31:18.881Z","avatar_url":"https://github.com/pdelboca.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n===========\ndjango-dcat\n===========\n\ndjango-dcat is a Django app that provides a model layer for `DCAT 3.0 \u003chttps://www.w3.org/TR/vocab-dcat-3/\u003e`_\nmetadata and some command line tools to import data to it, to create vocabularies and more.\n\nIf you wanna see an example of what can be done checkout `Catalogo Social \u003chttps://catalogosocial.fly.dev/\u003e`_, a\ndata catalog implemented with django-dcat.\n\ndjango-dcat `was presented at the CSV Conf 2024 \u003chttps://www.youtube.com/watch?v=8dUyi4OYAdM\u003e`_ in talk about \nhow to preserve and backup open data portals.\n\nQuick start\n###########\n\n1. Install the package using pip::\n\n    pip install django-dcat\n\n2. Add \"dcat\" to your INSTALLED_APPS setting like this::\n\n    INSTALLED_APPS = [\n        ...,\n        \"dcat\",\n    ]\n\n3. Run ``python manage.py migrate`` to create the DCAT models in your database.\n\n4. Start the development server and visit http://127.0.0.1:8000/admin/\n   to start adding data (you'll need the Admin app enabled).\n\n5. Run ``python manage.py --help`` to see the available commands.\n\nCLI utilities\n#############\n\nMigrating from CKAN\n*******************\n\nThere are two commands that allows you to:\n\n1) Make a dump of data from a CKAN data portal (that has `ckanext-datajson \u003chttps://github.com/GSA/ckanext-datajson\u003e`_ installed)\n2) Create a Catalog with its related entities (datasets, distributions, etc)\n\n.. code:: bash\n\n    # Download the data.json file from the portal\n    $ wget -O data.json https://www.ckan-example.org/data.json\n\n    # Download all files from the portal (by default in a data/ folder)\n    $ python manage.py dump_from_datajson\n\n    # Import all data and files into a local catalog\n    $ python manage.py import_from_datajson\n\n\nControlled vocabularies for standardise metadata\n************************************************\n\nThere are two commands to import controlled vocabularies used in the EU Open Data Portal in order to standardise the metadata.\n\n.. code:: bash\n\n    # Populate records for the MediaType model (CSV, PDF, etc)\n    $ python manage.py import_filetypes\n\n    # Populate records for Licences (MIT, Apache, etc)\n    $ python manage.py import_licences\n\n\nThe goal of these commands is to provide data publishers with pre-filled options for the metadata fields. This will improve\ndata quality and avoid common problems like duplicated metadata values for typos or inconsistent data entry (like distributions with\n.csv, .CSV, CSV, etc)\n\n\nDCAT Serialization\n##################\n\nEvery object contains methods to serialize it to different formats. This way it is easy to implement a feed URL for your catalog.\n\n - ``catalog.to_jsonld()``: (WIP) exports the catalog to a JSONLD format. The implementation has been inspired by the `FAO - Data in Emergencies feed \u003chttps://data-in-emergencies.fao.org/api/feed/dcat-ap/2.1.1.json\u003e`_.\n - ``catalog.to_turtle()``: TODO\n - ``catalog.to_rdf()``: TODO\n\n\nExtending the model\n###################\n\n``django-dcat`` focuses on providing a model layer for DCAT metadata. However, if you require custom fields in your application,\nyou can extend any model using a OneToOneField pattern (similar to what you use to extend Django's User model).\n\n.. code:: python\n\n    from django.db import models\n    from dcat.models import Distribution\n\n\n    class DistributionExtras(Distribution):\n        distribution = models.OneToOneField(Distribution, on_delete=models.CASCADE, related_name='extras')\n        my_extra_field = models.CharField(max_length=255, blank=True, null=True)\n\nAnd then you can call this fields from your code using the related name attribute:\n\n.. code:: python\n\n    from dcat.models import Distribution\n\n    distribution = Distribution.objects.get(pk=1)\n    print(distribution.extras.my_extra_field)\n\n\nNote: Instead of calling it ``extras`` You can play with more semantic names for the related_name\nattribute like the name of your app.\n\n\nImplementation notes\n####################\n\nThe Django models in this package are inspired by the diagram presented in DCAT profiles.\n\nSee the diagram: `UML diagram illustrating the DCAT-AP specification \u003chttps://semiceu.github.io/DCAT-AP/releases/3.0.0/html/overview.jpg\u003e`_\n\nFor more information on DCAT:\n - `Data Catalog Vocabulary (DCAT) - Version 3.0 \u003chttps://www.w3.org/TR/vocab-dcat-3/\u003e`_\n - `DCAT-AP profile \u003chttps://semiceu.github.io/DCAT-AP/releases/3.0.0/\u003e`_\n\n\nPublishing a new Version\n########################\n\nThe project uses twine to publish to PyPi:\n\n - Update the version in ``setup.cfg``\n - Create a new release in Github.\n - Build the package: ``python -m build``\n - Upload to PyPi ``twine upload dist/*``\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdelboca%2Fdjango-dcat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdelboca%2Fdjango-dcat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdelboca%2Fdjango-dcat/lists"}