heliport.data_management_plan package
Subpackages
Submodules
heliport.data_management_plan.admin module
Registers Django admin pages.
See django.contrib.admin.ModelAdmin
from Django documentation.
heliport.data_management_plan.apps module
Django app configuration.
Some HELIPORT hooks can be registered in app config django.apps.AppConfig.ready()
.
See also Django documentation
heliport.data_management_plan.interface module
Module with special name “interface” hooks into HELIPORT.
Some functions and heliport.core.app_interaction.Module
subclasses are detected
by HELIPORT and control how HELIPORT uses this app.
Note that this module must be imported in __init__.py of the django app.
- class heliport.data_management_plan.interface.DataManagementPlanModule
Bases:
Module
- get_url(project)
Return the URL for the entry point of this module.
- is_configured(project)
Return whether the module is configured, i.e. to show it in the graph.
- module_id = 'data_management_plan'
- name = 'Data Management Plan'
- heliport.data_management_plan.interface.get_search_url()
Return the search URL for this app.
This URL is used to implement the global HELIPORT string search.
heliport.data_management_plan.models module
Contains django.db.models.Model
classes for Django ORM.
See Quick example from Django documentation.
In HELIPORT the heliport.core.models.DigitalObject
can be subclassed for models
containing metadata in a project.
- class heliport.data_management_plan.models.DataManagementPlan(digital_object_id, persistent_id, generated_persistent_id, category, label, label_is_public, description, description_is_public, created, last_modified, last_modified_is_public, deleted, permission, special_heliport_role, is_helper, projects_is_public, owner, members_is_public, digitalobject_ptr, data_management_plan_id)
Bases:
DigitalObject
- exception DoesNotExist
Bases:
DoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- data_management_plan_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- digitalobject_ptr
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- digitalobject_ptr_id
- link
Defines a python descriptor for metadata properties.
This descriptor should be used on
DigitalObject
subclasses.In principle most properties of subclasses of
DigitalObject
can be considered “Metadata Properties” however usingMetadataFiled
has the added convenience that metadata serialization is automatically taken care of just by specifying the metadata property in the class definition. On top of that Storage if the property is public and can be shown on the landing page to everybody is handled without extra code.Use it for example like this:
class MyClass(DigitalObject): link = MetadataField(Vocabulary.primary_topic, url_normalizer)
The first argument comes from
Vocabulary
and defines the metadata property to use for serialization. The second argument is optional and is just a function that is called before setting the value.heliport.core.utils.normalization.url_normalizer()
is used in the example.The values are stored as
DigitalObjectAttributes
and identified by thir property as well as an additional identification string that is by default “attribute”. This means if you have multiple properties with the same metadata property you need to set therole_name_in_db
parameter uniquely for each. Also if you change the metadata attribute or therole_name_in_db
you need to write a database migration.
heliport.data_management_plan.serializers module
This module is for serialization into Datacite, RDF and JSON.
The JSON format is used for API endpoints via Django rest framework. Using this, it is typical to put the serializer classes into a “serializers.py” file.
For the serialization into RDF, attributes are described.
See heliport.core.attribute_description.BaseAttribute
for more detail.
- class heliport.data_management_plan.serializers.DataManagementPlanSerializer(*args, **kwargs)
Bases:
ModelSerializer
- class Meta
Bases:
object
- fields = ['data_management_plan_id', 'description', 'link', 'projects', 'namespace_str']
- model
alias of
DataManagementPlan
- create(validated_data)
- class heliport.data_management_plan.serializers.DmpDATACITESerializer
Bases:
DigitalObjectDATACITESerializer
- resource_type(dmp)
heliport.data_management_plan.tests module
Test the behaviour of this app.
This follows the Writing tests guide in Django.
- class heliport.data_management_plan.tests.DataManagementPlanTests(methodName='runTest')
Bases:
TestCase
Test functionality of data_management_plan app.
- setUp()
Set up project and logged-in heliport users.
- test_add_protocol_create()
Test that url is normalized when creating a DMP.
- test_add_protocol_update()
Test that url is normalized when updating a DMP.
- test_create()
Test creating new DMP.
- test_delete()
Test deleting DMP.
- test_list()
Test listing DMPs.
- test_update()
Test editing DMP.
- class heliport.data_management_plan.tests.ProjectSerializeTest(methodName='runTest')
Bases:
TestCase
Test metadat serialization.
- static landing_page_url(obj)
Get landing page URL for given object.
- setUp()
Set up project, instance and logged-in heliport users.
- test_datacite()
Test datacite serialization.
- test_json_ld()
Test JSON LD serialization.
- test_rest_api()
Test REST API with its JSON serialization.
- class heliport.data_management_plan.tests.SearchAndAPITest(methodName='runTest')
Bases:
TestCase
Test search including via API.
- setUp()
Set up project and logged-in heliport users.
- test_access_search()
Test that search URL is accessible.
- test_api()
Test api.
- test_data_management_plan_findable()
Test that dmp is findable.
heliport.data_management_plan.urls module
Map django views to urls.
See this Example including explanation from the Django documentation.
heliport.data_management_plan.views module
Contains Django View classes to handle HTTP requests.
See Using class-based views from Django
documentation.
In HELIPORT heliport.core.mixins
are used to create uniform views. Also
heliport.core.views.generic.HeliportObjectListView
is used to quicly create a
typical HELIPORT list view.
- class heliport.data_management_plan.views.DataManagementPlanUpdateView(**kwargs)
Bases:
HeliportObjectMixin
,UpdateView
- fields = ['description']
- form_valid(form)
- get_context_data(**kwargs)
Add extra context for rendering template (Called by django base view).
The extra context includes the DMPs to show.
- get_success_url()
- model
alias of
DataManagementPlan
- template_name = 'data_management_plan/data_management_plan.html'
- class heliport.data_management_plan.views.DataManagementPlanView(**kwargs)
Bases:
HeliportProjectMixin
,CreateView
- fields = ['description']
- form_valid(form)
- get_context_data(**kwargs)
Add extra context for rendering template (Called by django base view).
The extra context includes the DMPs to show.
- get_success_url()
- model
alias of
DataManagementPlan
- post(request, *args, **kwargs)
- template_name = 'data_management_plan/data_management_plan.html'
- class heliport.data_management_plan.views.DataManagementPlanViewSet(**kwargs)
Bases:
HeliportModelViewSet
Data Management Plan.
- filter_backends = [<class 'rest_framework.filters.SearchFilter'>, <class 'django_filters.rest_framework.backends.DjangoFilterBackend'>]
- filterset_fields = ['data_management_plan_id']
- get_queryset()
- search_fields = ['attributes__value']
- serializer_class
alias of
DataManagementPlanSerializer
- class heliport.data_management_plan.views.SearchView(**kwargs)
Bases:
HeliportLoginRequiredMixin
,TemplateView
- get_context_data(**kwargs)
Add extra context for rendering template (Called by django base view).
The extra context includes the search results.
- template_name = 'data_management_plan/search.html'
Module contents
App to store metadata about data management plans.
The interface
module is imported to the top level of the package for HELIPORT app
interface discovery (see heliport.core.app_interaction.get_heliport_apps()
).