Skip to content

Add citation argument to get_x_projects()#518

Merged
PietrH merged 179 commits intomainfrom
388-cite_functions
Apr 14, 2026
Merged

Add citation argument to get_x_projects()#518
PietrH merged 179 commits intomainfrom
388-cite_functions

Conversation

@PietrH
Copy link
Copy Markdown
Member

@PietrH PietrH commented Mar 26, 2026

In this PR I've added a helper cite_imis_dataset() that handles parallel requests to MarineInfo/IMIS and parses the output to a rectangular format. This is actually quite a hassle because there are a lot of exceptions in the data.

This helper is called by get_acoustic_projects() and get_animal_projects() to add a few columns with citation information when the user sets the argument citation = TRUE.

In the end I decided to keep all functionality together in one big helper. I could split off the parsing and the request logic. That's not too much hassle but I didn't see much short term benefit.

Tests use cached HTTP responses by default because MarineInfo/IMIS takes a while to respond. This is also why I don't add citation information by default.

I'm very open to all feedback!

Todo

Review comments

  • Bug in get_animal_projects(animal_project_code = "ADST-Shark", citation = TRUE)
  • Consider complicating ownership logic to prefer contacts over owners
  • Documentation of how the contact is selected is not factually correct, it's selected on OrderNr, otherwise order of response object. Not by creator or authorship status. -> Added logic, I made it so.
  • Add retries, throtteling
  • Drop support for shared first authorship: introduces extra rows downstream.
  • Rename contact columns
  • DOI format changes
  • Switch contact name format to FirstName then Surname (instead of Surname, FirstName).
  • Extend to get_cpod_projects()
  • Mention get_cpod_projects() in the relevant documentation.
  • There's a typo (ogical) and repeated content in the documentation.
  • Explain qs2 file
  • Consider removing qs2 serialized vcr cache and either skip, or remove test.

Encoding issue

The encoding issue is probably due to an interpretation difference in non breaking spaces between ISO-8859-1 and UTF-8. This stackoverflow thread might hold the solution: https://stackoverflow.com/questions/1461907/html-encoding-issues-%C3%82-character-showing-up-instead-of-nbsp

PietrH and others added 30 commits October 2, 2025 14:49
@PietrH PietrH requested a review from peterdesmet April 10, 2026 14:48
@PietrH
Copy link
Copy Markdown
Member Author

PietrH commented Apr 10, 2026

I made all requested changes. You can merge if you don't feel a second review is necessary. I also messed with the logic on how to select the contact person a bit, handling more edge cases.

@peterdesmet peterdesmet changed the title Add citations argument to get_acoustic_projects() and get_animal_projects() Add citation argument to get_x_projects() Apr 10, 2026
Copy link
Copy Markdown
Member

@peterdesmet peterdesmet left a comment

Choose a reason for hiding this comment

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

I have the impression something seems to be going wrong with the citation. It's empty more often than before. E.g. it's empty for 2014_demer.

@PietrH
Copy link
Copy Markdown
Member Author

PietrH commented Apr 14, 2026

I have the impression something seems to be going wrong with the citation. It's empty more often than before. E.g. it's empty for 2014_demer.

Added some extra tests, and fixed the bug in the string building.

@PietrH
Copy link
Copy Markdown
Member Author

PietrH commented Apr 14, 2026

Tests are dependent on the specific IMIS datasets not changing (adding or removing dois would break things).

I see 2 solutions, both adding complexity to the tests:

  1. Check if the dataset we are testing on is still applicable before the actual test (add expectations)
  2. Search for an applicable example dataset before the test, and then test on that.

@PietrH PietrH requested a review from peterdesmet April 14, 2026 09:17
Copy link
Copy Markdown
Member

@peterdesmet peterdesmet left a comment

Choose a reason for hiding this comment

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

Looks great, @PieterjanVerhelst should be happy with this new functionality.

@PieterjanVerhelst, you can try this out with:

get_animal_projects(citation = TRUE)

@PietrH PietrH merged commit 52dc6a9 into main Apr 14, 2026
10 checks passed
@PietrH PietrH deleted the 388-cite_functions branch April 14, 2026 14:02
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.

Return acoustic + animal project citations

2 participants