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

Add support to SeaNoe: #84 #85

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions datahugger/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from datahugger.services import MendeleyDataset
from datahugger.services import OSFDataset
from datahugger.services import PangaeaDataset
from datahugger.services import SeaNoeDataset
from datahugger.services import ZenodoDataset

# fast lookup
Expand Down Expand Up @@ -112,6 +113,7 @@
"researchdata.ntu.edu.sg": DataverseDataset,
"rin.lipi.go.id": DataverseDataset,
"ssri.is": DataverseDataset,
"www.seanoe.org": SeaNoeDataset,
"trolling.uit.no": DataverseDataset,
"www.sodha.be": DataverseDataset,
"www.uni-hildesheim.de": DataverseDataset,
Expand Down
20 changes: 20 additions & 0 deletions datahugger/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,23 @@ def _get_attr_hash(self, record):

def _get_attr_hash_type(self, record):
return self._get_attr_attr(record, self.ATTR_HASH_JSONPATH).split(":")[0]


class SeaNoeDataset(DatasetDownloader):
"""Downloader for SeaNoe publication."""

REGEXP_ID = r"https://www.seanoe\.org/data/[0-9]+/(?P<record_id>.*)/"

# the base entry point of the REST API
API_URL = "https://www.seanoe.org/api/"

# the files and metadata about the dataset
API_URL_META = "{api_url}find-by-id/{record_id}"
META_FILES_JSONPATH = "files[*]"

# paths to file attributes
ATTR_NAME_JSONPATH = "fileName"
ATTR_FILE_LINK_JSONPATH = "fileUrl"
ATTR_SIZE_JSONPATH = "size"
ATTR_HASH_JSONPATH = "checksum"
ATTR_HASH_TYPE_VALUE = "sha256"
4 changes: 4 additions & 0 deletions tests/test_repositories.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,7 @@ files = "AA_age.tab"
[[github]]
location = "https://github.com/j535d165/cbsodata"
files = "cbsodata-main/README.md"

[[seanoe]]
location = "https://doi.org/10.17882/101042"
files = "111609.xlsx"
Loading