Skip to content

Commit

Permalink
docs: revise descriptions of a few utilities
Browse files Browse the repository at this point in the history
Enhance descriptions and provide examples for the utility functions
'get_local_dataset_group_id,' 'get_local_dataset_endpoint,' and
'get_gbif_dataset_uuid' to facilitate better understanding.
  • Loading branch information
clnsmth authored Sep 28, 2023
1 parent 37745d6 commit eae5990
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
34 changes: 16 additions & 18 deletions src/gbif_registrar/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ def complete_registration_records(registrations):


def get_local_dataset_group_id(local_dataset_id):
"""Get the local_dataset_group_id value.
"""Return the local_dataset_group_id value.
Parameters
----------
local_dataset_id : str
Identifier of the local dataset to be registered with GBIF. The
local_dataset_group_id value is derived from this value.
The dataset identifier in the EDI repository. Has the format:
{scope}.{identifier}.{revision}.
Returns
-------
Expand All @@ -209,13 +209,13 @@ def get_local_dataset_group_id(local_dataset_id):


def get_gbif_dataset_uuid(local_dataset_group_id, rgstrs):
"""Get the gbif_dataset_uuid value.
"""Return the gbif_dataset_uuid value.
Parameters
----------
local_dataset_group_id : str
Identifier of the local dataset group to be registered with GBIF. The
gbif_dataset_uuid value is created by GBIF and returned upon request.
The dataset group identifier in the EDI repository. Has the format:
{scope}.{identifier}.
rgstrs : pandas dataframe
The registrations file as a dataframe.
Expand All @@ -224,23 +224,21 @@ def get_gbif_dataset_uuid(local_dataset_group_id, rgstrs):
-------
str
The gbif_dataset_uuid value. This is the UUID assigned by GBIF to the
local dataset group. A new value will be returned if a
local dataset group identifier. A new value will be returned if a
gbif_dataset_uuid value doesn't already exist for a
local_dataset_group_id.
Notes
-----
The local_dataset_group_id and gbif_dataset_uuid values have a one-to-one
relationship because this allows a dataset series (i.e. multiple versions
of a dataset) to be registered with GBIF as a single dataset and displayed
from a single URL endpoint on the GBIF system.
The rgstrs dataframe is used to check if a gbif_dataset_uuid value already
exists for a local_dataset_group_id. If a gbif_dataset_uuid value already
exists for a local_dataset_group_id, then the existing gbif_dataset_uuid
value is returned. If a gbif_dataset_uuid value does not already exist
for a local_dataset_group_id, then a new gbif_dataset_uuid value is
created and returned.
The local_dataset_group_id and gbif_dataset_uuid values have a one-to-one
relationship because this allows a dataset series (i.e. multiple versions
of a dataset) to be registered with GBIF as a single dataset and displayed
from a single URL endpoint on the GBIF system.
Examples
--------
>>> registrations = read_registrations_file("registrations.csv")
>>> get_gbif_dataset_uuid("edi.929", registrations)
"""
# Look in the rgstrs dataframe to see if there is a matching
# local_data_set_group_id value, and it has a non-empty gbif_dataset_uuid
Expand Down
10 changes: 7 additions & 3 deletions src/gbif_registrar/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,23 @@ def is_synchronized(local_dataset_id, file_path):


def get_local_dataset_endpoint(local_dataset_id):
"""Get the local_dataset_endpoint value.
"""Return the local_dataset_endpoint value.
Parameters
----------
local_dataset_id : str
Identifier of the local dataset to be registered with GBIF. The
local_dataset_endpoint value is derived from this value.
The dataset identifier in the EDI repository. Has the format:
{scope}.{identifier}.{revision}.
Returns
-------
str
The local_dataset_endpoint URL value. This is the URL GBIF will crawl
to access the local dataset.
Examples
--------
>>> get_local_dataset_endpoint("knb-lter-nin.1.1")
"""
scope = local_dataset_id.split(".")[0]
identifier = local_dataset_id.split(".")[1]
Expand Down

0 comments on commit eae5990

Please sign in to comment.