Skip to content

Commit

Permalink
Add support to SeaNoe (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer authored Sep 29, 2024
1 parent 9447f97 commit 6ca501b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
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"

0 comments on commit 6ca501b

Please sign in to comment.