Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8ae31ce
Test fix: recreate cassette
PietrH Apr 20, 2026
31ed8d6
Activate test
PietrH Apr 20, 2026
c54f893
Store snapshot
PietrH Apr 20, 2026
4321aaa
Don't cache encoding test: detect changes in api response
PietrH Apr 20, 2026
4476194
Add extra tests for file integrity
PietrH Apr 21, 2026
5752c92
Check if cleaning whitespace helps
PietrH Apr 21, 2026
9cfea5f
Don't read from drive, remove sanity check
PietrH Apr 21, 2026
5a3a4b9
Read from marineinfo
PietrH Apr 21, 2026
a1d94e2
Recreate cassettes for marineinfo
PietrH Apr 21, 2026
bb3c477
Store JSON files in temp folder, and read from disk. Does this solve …
PietrH Apr 21, 2026
6519eb5
Disable vcr, will not handle reading from disk very nicely
PietrH Apr 21, 2026
0938112
Update snapshot
PietrH Aug 18, 2026
66c15d7
No longer have example of missing citation
PietrH Aug 18, 2026
1d0b6a2
Try if nfc conversion helps against encoding issue
PietrH Aug 18, 2026
19fae44
Merge branch 'main' into 521-encoding-issue
PietrH Aug 20, 2026
ddbb84e
Reformat comment
PietrH Aug 20, 2026
1d1569d
Make path reading explicit
PietrH Aug 20, 2026
852ace7
Database changes, update snapshots
PietrH Aug 20, 2026
24f61f4
Switch back to reading the json from the response
PietrH Aug 20, 2026
0939a90
Update cassettes: database changes
PietrH Aug 20, 2026
e59a299
Don't save to disk.
PietrH Aug 20, 2026
c751e95
Switch R4.1 check to ubuntu, Cmake win32 support is dodgy for buildin…
PietrH Aug 20, 2026
865954f
Revert "Switch R4.1 check to ubuntu, Cmake win32 support is dodgy for…
PietrH Aug 20, 2026
d620e21
Merge branch 'main' into 521-json-in-memory
PietrH Aug 20, 2026
7f1dad5
Merge branch 'main' into 521-encoding-issue
PietrH Aug 20, 2026
78fc36c
Merge branch 'main' into 521-encoding-issue
PietrH Aug 20, 2026
af027fe
Merge branch 'main' into 521-json-in-memory
PietrH Aug 20, 2026
800d426
Merge branch '521-encoding-issue' into 521-json-in-memory
PietrH Aug 20, 2026
d3c97c5
Recreate snapthot: more citations became available
PietrH Aug 21, 2026
e19e713
Recreate cassettes: database changes
PietrH Aug 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Imports:
purrr,
readr,
rlang,
stringi,
stringr,
utils,
withr
Expand Down
17 changes: 14 additions & 3 deletions R/cite_imis_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ cite_imis_dataset <- function(imis_dataset_ids = NULL,
# Query the IMIS API ------------------------------------------------------

marineinfo_dataset_endpoints <-
glue::glue("https://vliz.be/en/imis?dasid={imis_dataset_ids}&show=json")
glue::glue("https://marineinfo.org/id/dataset/{imis_dataset_ids}.json")

json_tempdir <- withr::local_tempdir(pattern = "marineinfo_json",
.local_envir = environment())

marineinfo_responses <-
purrr::map(marineinfo_dataset_endpoints, httr2::request) |>
Expand Down Expand Up @@ -110,7 +113,9 @@ cite_imis_dataset <- function(imis_dataset_ids = NULL,

marineinfo_metadata <-
succesful_responses |>
purrr::map(httr2::resp_body_json, simplifyDataFrame = TRUE) |>
purrr::map(\(response) {
httr2::resp_body_json(response, simplifyVector = TRUE)
}) |>
# Set names to acronym, get_acoustic_projects() doesn't guarantee order of
# results so we can't just get this from the acoustic_project_codes argument
(\(returned_list) {
Expand Down Expand Up @@ -140,7 +145,13 @@ cite_imis_dataset <- function(imis_dataset_ids = NULL,
purrr::pluck(dataset_metadata, "datasetrec", "Citation",
# When Citation is missing, this object is NA_character_
.default = NA_character_
)
) |>
# Replace all whitespace (including newlines) with a single space, then trimClean the whitespace, was causing snapshot failures on Mac and Windows
stringr::str_replace_all("\\s", " ") |>
stringr::str_squish() |>
# Make sure the string is in NFC form, otherwise the snapshot tests fail
# on Windows and MacOS
stringi::stri_trans_nfc()

dplyr::tibble(
citation =
Expand Down
1 change: 1 addition & 0 deletions inst/extdata/marineinfo-dataset-8856.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"datasetrec":{"DasID":8856,"Acronym":"2004_Gudena","StandardTitle":"Acoustic receiver array in the Gudena River, Denmark, from 2004-2006","OrigTitle":null,"OrigTitleLangID":null,"OrigTitleLangCode":null,"OrigTitleLang":null,"OrigTitleLangNL":null,"VersionName":null,"ContactEmail":null,"VersionDate":null,"VersionDay":null,"VersionMonth":null,"VersionYear":null,"SizeReference":null,"EngAbstract":"<p>The population of European silver eel (<i>Anguilla anguilla)</i> has declined tremendously in the last decades. The cause of this decline is unknown, and it is necessary to investigate the migratory behaviour and survival rates of silver eels during the reproductive migration in order to understand if the decline is related to factors acting during that migration. We estimated survival and progression rates of European silver eel migrating in the lower part of the River Gudenaa and during the first phase of the marine migration in the Randers Fjord in Denmark. &nbsp;Migration was monitored using an array of 14 Innovasea (VR2) acoustic receivers distributed accross 10 stations. Progression rate and mortality in the river, inner part of the fjord and outer part of the fjord were estimated.</p>","EngDescr":null,"OrigAbstract":null,"OrigDescr":null,"Comments":null,"ReleaseDate":null,"ReleaseDate0":null,"OrigDescrLang":null,"EmbargoDate":null,"OrigDescrLangNL":null,"OrigLangCode":null,"OrigLangCodeExtended":null,"OrigLangID":null,"DescrCompFlag":null,"DescrTransFlag":null,"Citation":"Aarestrup, K.; Thorstad, EB.; Koed, A.; Svendsen, JC.; Jepsen, N.; Pedersen, MI.; &nbsp;Økland, F.; (2004) Acoustic receiver array in the Gudena River, Denmark, from 2005-2005","AccessConstraints":null,"InputNotes":null,"UDate":"2025-05-07","CDate":"2025-05-07","CurrencyDate":null,"RevisionDate":null,"DateLastModified":{"date":"2025-07-02 08:33:20.512335","timezone_type":1,"timezone":"+02:00"},"CheckedFlag":0,"PublicFlag":1,"VlizCoreFlag":1,"MarineFlag":0,"FreshFlag":1,"BrackishFlag":0,"TerrestrialFlag":0,"StatusID":1,"DasType":"Data","DasTypeID":1,"DasOrigin":"Sensor platform","Progress":"Completed","AccessConstraint":"Attribution (CC BY)","AccConstrEN":"Attribution (CC BY)","AccConstrDisplay":"<a rel=\"license\" href=\"https://creativecommons.org/licenses/by/4.0/\" target=\"_blank\"><img alt=\"Creative Commons License\" style=\"border:0px;height:15px;width:80px;vertical-align:middle;\" src=\"https://www.marinespecies.org/aphia/images/cc/by.png\" /></a> This dataset is licensed under a <a rel=\"license\" href=\"https://creativecommons.org/licenses/by/4.0/\" target=\"_blank\">Creative Commons Attribution 4.0 International License</a>.","License":"https://creativecommons.org/licenses/by/4.0/","AccConstrDescription":"This license lets others distribute, remix, tweak, and build upon your work, even commercially, as long as they credit you for the original creation. This is the most accommodating of licenses offered. Recommended for maximum dissemination and use of licensed materials.","Lineage":null,"AccConID":21},"dois":[{"DOIID":1172,"PublicationYear":2025,"DOI":"10.14284/735","Citation":"Aarestrup, K.; Thorstad, EB.; Koed, A.; Svendsen, JC.; Jepsen, N.; Pedersen, MI.;  Økland, F.; (2004) Acoustic receiver array in the Gudena River, Denmark, from 2005-2005","MDAID":null,"Moratorium":0,"MDAURL":null,"CurrentDOI":1,"Active":1,"URL":null,"downloadURL":null}],"spcols":[{"SpColID":1000,"SpName":"European Tracking Network"}],"keywords":[{"ThesaurusTerm":"Acoustic arrays","ThesTypID":1,"ThesType":"ASFA Thesaurus List","Code":"c_2cdfca90","Description":null,"OrigThesTerm":"Acoustic arrays","DutchTerm":null,"URI":"http://aims.fao.org/aos/agrovoc/c_2cdfca90","DasKeywordDescr":null},{"ThesaurusTerm":"Acoustic data","ThesTypID":1,"ThesType":"ASFA Thesaurus List","Code":"c_54b338c3","Description":null,"OrigThesTerm":"Acoustic data","DutchTerm":null,"URI":"http://aims.fao.org/aos/agrovoc/c_54b338c3","DasKeywordDescr":null},{"ThesaurusTerm":"Acoustic detection","ThesTypID":1,"ThesType":"ASFA Thesaurus List","Code":null,"Description":null,"OrigThesTerm":"Acoustic detection","DutchTerm":null,"URI":null,"DasKeywordDescr":null},{"ThesaurusTerm":"Acoustic devices","ThesTypID":1,"ThesType":"ASFA Thesaurus List","Code":null,"Description":null,"OrigThesTerm":"Acoustic devices","DutchTerm":null,"URI":null,"DasKeywordDescr":null},{"ThesaurusTerm":"Acoustic receivers","ThesTypID":0,"ThesType":null,"Code":null,"Description":null,"OrigThesTerm":"Acoustic receivers","DutchTerm":null,"URI":null,"DasKeywordDescr":null},{"ThesaurusTerm":"Acoustic telemetry","ThesTypID":1,"ThesType":"ASFA Thesaurus List","Code":"c_3563933f","Description":null,"OrigThesTerm":"Acoustic telemetry","DutchTerm":null,"URI":"http://aims.fao.org/aos/agrovoc/c_3563933f","DasKeywordDescr":null},{"ThesaurusTerm":"Acoustic Telemetry","ThesTypID":30,"ThesType":"ETN Context","Code":null,"Description":"Acoustic telemetry uses acoustic signals (also called ‘pings’) which propagate into the water, and are detected by acoustic receivers","OrigThesTerm":"Acoustic Telemetry","DutchTerm":"Akoestische Telemetrie","URI":null,"DasKeywordDescr":null},{"ThesaurusTerm":"Acoustic tracking","ThesTypID":1,"ThesType":"ASFA Thesaurus List","Code":null,"Description":null,"OrigThesTerm":"Acoustic tracking","DutchTerm":null,"URI":null,"DasKeywordDescr":null},{"ThesaurusTerm":"Acoustic tracking","ThesTypID":4,"ThesType":"CAB Thesaurus","Code":"5296","Description":null,"OrigThesTerm":"Acoustic tracking","DutchTerm":null,"URI":"https://id.cabi.org/cabt/5296","DasKeywordDescr":null},{"ThesaurusTerm":"Acoustic tracking systems","ThesTypID":1,"ThesType":"ASFA Thesaurus List","Code":null,"Description":null,"OrigThesTerm":"Acoustic tracking systems","DutchTerm":null,"URI":null,"DasKeywordDescr":null},{"ThesaurusTerm":"Denmark","ThesTypID":34,"ThesType":"ASFA Geoterms","Code":null,"Description":null,"OrigThesTerm":"Denmark","DutchTerm":null,"URI":null,"DasKeywordDescr":null},{"ThesaurusTerm":"Network Project","ThesTypID":30,"ThesType":"ETN Context","Code":null,"Description":"Project metadata related to receivers and deployments","OrigThesTerm":"Network Project","DutchTerm":"Network Project","URI":null,"DasKeywordDescr":null}],"parents":[{"DasID":5912,"Acronym":null,"EngAbstract":"The European Tracking Network is a pan-European biotelemetry network that aims at the integration of regional telemetry initiatives into a sustainable, efficient and integrated network embedded in the international context. Data is integrated in the ETN data system that is part of the ETN virtual lab developed by LifeWatch.","License":"https://creativecommons.org/licenses/by/4.0/","StandardTitle":"European Tracking Network (ETN) data","doi":null,"vlizDoi":null}],"children":null,"othrel":[{"DasID":6361,"Acronym":"2004_Gudena","StandardTitle":"Silver eel migration in the Gudena River, Denmark","Relation":"Related Dataset","RelationY":"Related Dataset","RelID":11,"doi":null,"vlizDoi":"10.14284/734"}],"othrelrev":null,"ownerships":[{"OrderNr":1,"Surname":"Aarestrup","Firstname":"Kim","Initials":"K.","PerPublicFlag":1,"AdrID":161019,"Email":"kaa@aqua.dtu.dk","InsPublicFlag":1,"Acronym":"DTU Aqua","OrigNameLangCode":"da","OrigNameLangID":12,"FullOrigName":"Danmarks Tekniske Universitet; Institut for Akvatiske Ressourcer","InsOwnerCNT":7,"PersID":35670,"InsID":9029,"FullInstitute":"Technical University of Denmark; National Institute of Aquatic Resources","RoleID":24,"Role":"Contact","OrigName":"Institut for Akvatiske Ressourcer","StandardName":"National Institute of Aquatic Resources","FullAcronym":"DTU-DTU Aqua","ORC":"https://orcid.org/0000-0001-8521-6270","ROR":null},{"OrderNr":2,"Surname":"Aarestrup","Firstname":"Kim","Initials":"K.","PerPublicFlag":1,"AdrID":161019,"Email":"kaa@aqua.dtu.dk","InsPublicFlag":1,"Acronym":"DTU Aqua","OrigNameLangCode":"da","OrigNameLangID":12,"FullOrigName":"Danmarks Tekniske Universitet; Institut for Akvatiske Ressourcer","InsOwnerCNT":7,"PersID":35670,"InsID":9029,"FullInstitute":"Technical University of Denmark; National Institute of Aquatic Resources","RoleID":59,"Role":"Principal Investigator","OrigName":"Institut for Akvatiske Ressourcer","StandardName":"National Institute of Aquatic Resources","FullAcronym":"DTU-DTU Aqua","ORC":"https://orcid.org/0000-0001-8521-6270","ROR":null},{"OrderNr":3,"Surname":"Aarestrup","Firstname":"Kim","Initials":"K.","PerPublicFlag":1,"AdrID":161019,"Email":"kaa@aqua.dtu.dk","InsPublicFlag":1,"Acronym":"DTU Aqua","OrigNameLangCode":"da","OrigNameLangID":12,"FullOrigName":"Danmarks Tekniske Universitet; Institut for Akvatiske Ressourcer","InsOwnerCNT":7,"PersID":35670,"InsID":9029,"FullInstitute":"Technical University of Denmark; National Institute of Aquatic Resources","RoleID":61,"Role":"Data creator","OrigName":"Institut for Akvatiske Ressourcer","StandardName":"National Institute of Aquatic Resources","FullAcronym":"DTU-DTU Aqua","ORC":"https://orcid.org/0000-0001-8521-6270","ROR":null},{"OrderNr":4,"Surname":"Thorstad","Firstname":"Eva Bonsak","Initials":"E.B.","PerPublicFlag":1,"AdrID":163016,"Email":"Eva.Thorstad@nina.no","InsPublicFlag":1,"Acronym":"NINA","OrigNameLangCode":"no","OrigNameLangID":42,"FullOrigName":"Norsk institutt for naturforskning","InsOwnerCNT":2,"PersID":38454,"InsID":7615,"FullInstitute":"Norwegian Institute for Nature Research","RoleID":61,"Role":"Data creator","OrigName":"Norsk institutt for naturforskning","StandardName":"Norwegian Institute for Nature Research","FullAcronym":"NINA","ORC":"https://orcid.org/0000-0002-7373-6380","ROR":null},{"OrderNr":5,"Surname":"Koed","Firstname":"Anders","Initials":"A.","PerPublicFlag":1,"AdrID":161136,"Email":"ak@aqua.dtu.dk","InsPublicFlag":1,"Acronym":"DTU Aqua","OrigNameLangCode":"da","OrigNameLangID":12,"FullOrigName":"Danmarks Tekniske Universitet; Institut for Akvatiske Ressourcer","InsOwnerCNT":7,"PersID":35736,"InsID":9029,"FullInstitute":"Technical University of Denmark; National Institute of Aquatic Resources","RoleID":61,"Role":"Data creator","OrigName":"Institut for Akvatiske Ressourcer","StandardName":"National Institute of Aquatic Resources","FullAcronym":"DTU-DTU Aqua","ORC":"https://orcid.org/0000-0002-2163-0955","ROR":null},{"OrderNr":6,"Surname":"Svendsen","Firstname":"Jon Christian","Initials":"J.C.","PerPublicFlag":1,"AdrID":163201,"Email":"jos@aqua.dtu.dk","InsPublicFlag":1,"Acronym":"DTU Aqua","OrigNameLangCode":"da","OrigNameLangID":12,"FullOrigName":"Danmarks Tekniske Universitet; Institut for Akvatiske Ressourcer","InsOwnerCNT":7,"PersID":14127,"InsID":9029,"FullInstitute":"Technical University of Denmark; National Institute of Aquatic Resources","RoleID":61,"Role":"Data creator","OrigName":"Institut for Akvatiske Ressourcer","StandardName":"National Institute of Aquatic Resources","FullAcronym":"DTU-DTU Aqua","ORC":null,"ROR":null},{"OrderNr":7,"Surname":"Jepsen","Firstname":"Niels","Initials":"N.","PerPublicFlag":1,"AdrID":161135,"Email":"nj@aqua.dtu.dk","InsPublicFlag":1,"Acronym":"DTU Aqua","OrigNameLangCode":"da","OrigNameLangID":12,"FullOrigName":"Danmarks Tekniske Universitet; Institut for Akvatiske Ressourcer","InsOwnerCNT":7,"PersID":35735,"InsID":9029,"FullInstitute":"Technical University of Denmark; National Institute of Aquatic Resources","RoleID":61,"Role":"Data creator","OrigName":"Institut for Akvatiske Ressourcer","StandardName":"National Institute of Aquatic Resources","FullAcronym":"DTU-DTU Aqua","ORC":"https://orcid.org/0000-0003-0927-6823","ROR":null},{"OrderNr":8,"Surname":"Pedersen","Firstname":"Michael Ingemann","Initials":"M.I.","PerPublicFlag":1,"AdrID":170560,"Email":"mip@aqua.dtu.dk","InsPublicFlag":1,"Acronym":"DTU Aqua","OrigNameLangCode":"da","OrigNameLangID":12,"FullOrigName":"Danmarks Tekniske Universitet; Institut for Akvatiske Ressourcer","InsOwnerCNT":7,"PersID":45910,"InsID":9029,"FullInstitute":"Technical University of Denmark; National Institute of Aquatic Resources","RoleID":61,"Role":"Data creator","OrigName":"Institut for Akvatiske Ressourcer","StandardName":"National Institute of Aquatic Resources","FullAcronym":"DTU-DTU Aqua","ORC":"https://orcid.org/0000-0002-3030-0704","ROR":null},{"OrderNr":9,"Surname":"Økland","Firstname":"Finn","Initials":"F.","PerPublicFlag":1,"AdrID":163015,"Email":"Finn.Okland@nina.no","InsPublicFlag":1,"Acronym":"NINA","OrigNameLangCode":"no","OrigNameLangID":42,"FullOrigName":"Norsk institutt for naturforskning","InsOwnerCNT":2,"PersID":38453,"InsID":7615,"FullInstitute":"Norwegian Institute for Nature Research","RoleID":61,"Role":"Data creator","OrigName":"Norsk institutt for naturforskning","StandardName":"Norwegian Institute for Nature Research","FullAcronym":"NINA","ORC":"https://orcid.org/0000-0002-1938-5460","ROR":null}],"taxterms":[{"DasTaxtTypID":1,"DasTaxtType":"Taxonomic coverage","TaxtID":11873,"TaxTerm":"Pisces","AphiaID":11676,"DutchTerm":"Vissen"},{"DasTaxtTypID":2,"DasTaxtType":"Target species","TaxtID":16735,"TaxTerm":"Anguilla anguilla (Linnaeus, 1758)","AphiaID":126281,"DutchTerm":"Paling"}],"frameworks":null,"otherterms":[{"OtherTerm":"Acoustic receivers"}],"temporal":[{"DasDateID":6419,"StartYear":2004,"EndYear":2006,"StartDay":null,"EndDay":null,"StartDate":"2004-03-01","EndDate":"2006-04-01","DasDate":null,"Resolution":"Quasi continuous (< 1 min.)","ResolutionNL":"Quasi continu (< 1 min.)","Notes":null,"StartMonth0":3,"StartMonth":"March","StartMonthNL":"Maart","EndMonth0":4,"EndMonth":"April","EndMonthNL":"April","Progress":"Completed","ProgressNL":"Afgelopen"}],"geographical":[{"GeoTerm":"Denmark","DasGeoID":14985,"DasGeoTerm":null,"DasID":8856,"GeotID":209,"X":9.9101999999999997,"Y":56.399500000000003,"MaxX":null,"MaxY":null,"StationName":null,"Precision":null,"CoordSystID":null,"GeoDatumID":null,"OrigCoordMinX":null,"OrigCoordMinY":null,"OrigCoordMaxX":null,"OrigCoordMaxY":null,"OrderNr":null,"Projection":null,"GeoDatum":null,"GeoObjectID":2157,"OrigGeoTerm":"Denmark","DutchTerm":null}],"meastypes":[{"MethID":522,"DasMeasTypID":20506,"DasMeasType":"","Matrix":"Water","MatrixNL":"Water","Parameter":"Acoustic detections","ParameterNL":null,"Description":null,"Unit":"Hz","Methodology":"Acoustic telemetry","Protocol":null,"QualityControl":null,"Precision":null,"Detectionlimit":null,"Instrument":null,"InstrumentUrl":null,"MethFull":"","ParaCategoryTitle":null,"ParaCatCode":null}],"dasthemes":[{"DasThemeID":101,"DasTheme":"Biology > Acoustics","DasTheme0":"Acoustics","DutchTerm":"Geluid"},{"DasThemeID":13,"DasTheme":"Physical > Underwater acoustics","DasTheme0":"Underwater acoustics","DutchTerm":"Onderwater geluidstechniek"}],"projects":null,"refs":null,"urls":[{"URL":"http://www.lifewatch.be/etn/","externalID":null,"URLTypeCode":null,"URLType":"Online dataset","URLTypID":19,"downloadURL":null,"FileName":null},{"URL":"https://rshiny.vsc.lifewatch.be/etn-data/","externalID":null,"URLTypeCode":null,"URLType":"Online dataset","URLTypID":19,"downloadURL":null,"FileName":null}],"pictures":[],"urlmaps":null,"spatreps":null,"fileformats":null,"resmessage":"","complete":1}
Binary file modified tests/fixtures/bibliography-2014demer.qs2
Binary file not shown.
Binary file modified tests/fixtures/bibliography-citations.qs2
Binary file not shown.
Binary file modified tests/fixtures/bibliography-gibraltar.qs2
Binary file not shown.
Loading