Skip to content

Interfaces

IDoi

Bases: Interface

Hook into IDoi.

Source code in ckanext/doi/interfaces.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class IDoi(interfaces.Interface):
    """
    Hook into IDoi.
    """

    def build_metadata_dict(self, pkg_dict, metadata_dict, errors):
        """
        Extracts metadata from a pkg_dict for use in generating datacite DOIs. Extends
        the build_metadata_dict method from ckanext-doi.

        :param pkg_dict: package dictionary
        :param metadata_dict: the current metadata dict, created by the ckanext-doi extension and
                              any previous plugins implementing IDoi
        :param errors: a dictionary of metadata keys and errors generated by previous plugins;
                       this method should remove any keys that it successfully processes and
                       overwrites
        :returns: metadata_dict, errors
        """
        return metadata_dict, errors

    def build_xml_dict(self, metadata_dict, xml_dict):
        """
        Converts the metadata_dict into an xml_dict that can be passed to the datacite
        library's schema42.tostring() and schema42.validate() methods. Extends the
        build_xml_dict() method from ckanext-doi.

        :param metadata_dict: the metadata dict generated from build_metadata_dict
        :param xml_dict: XML dict to pass to schema42.validate()
        :returns: xml_dict
        """
        return xml_dict

build_metadata_dict(pkg_dict, metadata_dict, errors)

Extracts metadata from a pkg_dict for use in generating datacite DOIs. Extends the build_metadata_dict method from ckanext-doi.

Parameters:

Name Type Description Default
pkg_dict

package dictionary

required
metadata_dict

the current metadata dict, created by the ckanext-doi extension and any previous plugins implementing IDoi

required
errors

a dictionary of metadata keys and errors generated by previous plugins; this method should remove any keys that it successfully processes and overwrites

required

Returns:

Type Description

metadata_dict, errors

Source code in ckanext/doi/interfaces.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def build_metadata_dict(self, pkg_dict, metadata_dict, errors):
    """
    Extracts metadata from a pkg_dict for use in generating datacite DOIs. Extends
    the build_metadata_dict method from ckanext-doi.

    :param pkg_dict: package dictionary
    :param metadata_dict: the current metadata dict, created by the ckanext-doi extension and
                          any previous plugins implementing IDoi
    :param errors: a dictionary of metadata keys and errors generated by previous plugins;
                   this method should remove any keys that it successfully processes and
                   overwrites
    :returns: metadata_dict, errors
    """
    return metadata_dict, errors

build_xml_dict(metadata_dict, xml_dict)

Converts the metadata_dict into an xml_dict that can be passed to the datacite library's schema42.tostring() and schema42.validate() methods. Extends the build_xml_dict() method from ckanext-doi.

Parameters:

Name Type Description Default
metadata_dict

the metadata dict generated from build_metadata_dict

required
xml_dict

XML dict to pass to schema42.validate()

required

Returns:

Type Description

xml_dict

Source code in ckanext/doi/interfaces.py
30
31
32
33
34
35
36
37
38
39
40
def build_xml_dict(self, metadata_dict, xml_dict):
    """
    Converts the metadata_dict into an xml_dict that can be passed to the datacite
    library's schema42.tostring() and schema42.validate() methods. Extends the
    build_xml_dict() method from ckanext-doi.

    :param metadata_dict: the metadata dict generated from build_metadata_dict
    :param xml_dict: XML dict to pass to schema42.validate()
    :returns: xml_dict
    """
    return xml_dict