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

DataCite Query Pagination Support #263

Merged
merged 6 commits into from
Oct 5, 2021

Conversation

collinss-jpl
Copy link
Contributor

🗒️ Summary

This PR adds support for DataCite's pagination scheme to the query function used to pull down existing DOI records from a DataCite server. This functionality should have been included with the original addition of DataCite support, but was overlooked.

In addition to pagination support, this branch adds several other small improvements, including:

  • Addition of "Radio Science" node ID to available PDS Node ID's recognized by DOI service
  • Better logging of warning messages from parsing of optional fields from a DataCite label
  • Better support for determining an appropriate node ID from a parsed DataCite label when importing to the local database

⚙️ Test Data and/or Report

One of the following should be included here:
A unit test has been added for the pagination support added to the DataCite web client.
test.txt

♻️ Related Issues

Fixes #261

@collinss-jpl collinss-jpl self-assigned this Oct 4, 2021
@collinss-jpl collinss-jpl requested a review from a team as a code owner October 4, 2021 23:31
Copy link
Member

@nutjob4life nutjob4life left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my question but otherwise looks fine 👌


# Append current results to full set returned
result = json.loads(datacite_response.text)
data.extend(result['data'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there ever be a concern that data grows overly large if, say, the totalPages is also overly large? Should we be using a generator style pattern here to compensate instead of gathering and returning the entire kit & kaboodle?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say this is not currently a concern based on two things:

  1. Based on the performance I observed importing all 1300+ records currently available on DataCite (which is only about a page and half):
INFO __main__:main DOI import complete in 23.26 seconds.
INFO __main__:main Num records found: 1390
INFO __main__:main Num records processed: 1390
INFO __main__:main Num records written: 1390
INFO __main__:main Num records skipped: 0
  1. This query function is only used right now for the local database importation script, so for the time being we shouldn't have to worry about an end-user of the service/UI running into some sort of performance bottleneck because we slurp all available pages.

@collinss-jpl collinss-jpl merged commit 9ab673f into main Oct 5, 2021
@nutjob4life
Copy link
Member

Thanks @collinss-jpl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query to DataCite does not properly support pagination
2 participants