Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PID minter & fetcher & provider factories #37

Open
mirekys opened this issue Aug 31, 2021 · 0 comments
Open

Implement PID minter & fetcher & provider factories #37

mirekys opened this issue Aug 31, 2021 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mirekys
Copy link
Member

mirekys commented Aug 31, 2021

Currently we need to repeatedly implement these in each data model, e.g:

def nr_datasets_id_fetcher(record_uuid, data):
    """Fetch a record's identifiers.

    :param record_uuid: The record UUID.
    :param data: The record metadata.
    :returns: A :data:`invenio_pidstore.fetchers.FetchedPID` instance.
    """
    id_field = 'InvenioID'
    return FetchedPID(  # FetchedPID je obyčejný namedtuple
        provider=NRDatasetsIdProvider,
        pid_type=NRDatasetsIdProvider.pid_type,
        pid_value=CommunityPIDValue(
            str(data[id_field]),
            current_oarepo_communities.get_primary_community_field(data))
    )

implement factories to be used like this

nr_datasets_id_fetcher = community_pid_fetcher(pid_type='blah', base_provider=RecordIdProviderV2)
nr_datasets_id_minter = community_pid_minter(pid_type='blah', base_provider=RecordIdProviderV2)
@mirekys mirekys added good first issue Good for newcomers help wanted Extra attention is needed labels Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant