Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Refactor Smithsonian Museum to use `ProviderDataIngester` class (#812)

Krystle Salazar977b6df3bb80
diff --git a/DAGs.md b/DAGs.md
index a5ae0c735..29fd3ccf2 100644
--- a/DAGs.md
+++ b/DAGs.md
@@ -497,14 +497,13 @@ reviewed once and so is only counted once in the reporting by this DAG.
## `smithsonian_workflow`
-Content Provider: Smithsonian
+Content Provider: Smithsonian
-ETL Process: Use the API to identify all CC licensed images.
+ETL Process: Use the API to identify all CC licensed images.
-Output: TSV file containing the images and the respective
- meta-data.
+Output: TSV file containing the images and the respective meta-data.
-Notes: None
+Notes: https://api.si.edu/openaccess/api/v1.0/search
## `stocksnap_workflow`
diff --git a/openverse_catalog/dags/providers/provider_api_scripts/brooklyn_museum.py b/openverse_catalog/dags/providers/provider_api_scripts/brooklyn_museum.py
index bf23448cd..a63670b8c 100644
--- a/openverse_catalog/dags/providers/provider_api_scripts/brooklyn_museum.py
+++ b/openverse_catalog/dags/providers/provider_api_scripts/brooklyn_museum.py
@@ -16,8 +16,8 @@ class BrooklynMuseumDataIngester(ProviderDataIngester):
endpoint = "https://www.brooklynmuseum.org/api/v2/object/"
batch_limit = 35
- def __init__(self, *args):
- super().__init__(*args)
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
self.api_key = Variable.get("API_KEY_BROOKLYN_MUSEUM")
self.headers = {"api_key": self.api_key}
diff --git a/openverse_catalog/dags/providers/provider_api_scripts/smithsonian.py b/openverse_catalog/dags/providers/provider_api_scripts/smithsonian.py
index d14e8e439..e24ac686c 100644
--- a/openverse_catalog/dags/providers/provider_api_scripts/smithsonian.py
+++ b/openverse_catalog/dags/providers/provider_api_scripts/smithsonian.py
@@ -1,531 +1,425 @@
"""
-Content Provider: Smithsonian
+Content Provider: Smithsonian
-ETL Process: Use the API to identify all CC licensed images.
+ETL Process: Use the API to identify all CC licensed images.
-Output: TSV file containing the images and the respective
- meta-data.
+Output: TSV file containing the images and the respective meta-data.
-Notes: None
+Notes: https://api.si.edu/openaccess/api/v1.0/search
"""
-import json
+
import logging
-import os
-from datetime import datetime
from typing import Tuple
from airflow.exceptions import AirflowException
from airflow.models import Variable
-from common.licenses import LicenseInfo
+from common import constants
+from common.licenses import get_license_info
from common.loader import provider_details as prov
-from common.requester import DelayedRequester
-from common.storage.image import ImageStore
+from providers.provider_api_scripts.provider_data_ingester import ProviderDataIngester
from retry import retry
logger = logging.getLogger(__name__)
-logging.basicConfig(
- format="%(asctime)s - %(name)s - %(levelname)s: %(message)s", level=logging.INFO
-)
-
-API_KEY = Variable.get("API_KEY_DATA_GOV", default_var=None)
-DELAY = 5.0
-HASH_PREFIX_LENGTH = 2
-LIMIT = 1000 # number of rows to pull at once
-API_ROOT = "https://api.si.edu/openaccess/api/v1.0/"
-SEARCH_ENDPOINT = API_ROOT + "search"
-UNITS_ENDPOINT = API_ROOT + "terms/unit_code"
-PROVIDER = prov.SMITHSONIAN_DEFAULT_PROVIDER
-# SUB_PROVIDERS is a collection of all providers within smithsonian
-SUB_PROVIDERS = prov.SMITHSONIAN_SUB_PROVIDERS
-ZERO_URL = "https://creativecommons.org/publicdomain/zero/1.0/"
-DEFAULT_PARAMS = {"api_key": API_KEY, "rows": LIMIT}
-RETRIES = 3
-# CREATOR_TYPES should have lower-case strings as keys, and integers as values.
-# The integers given the preference order of the different creator types, with
-# lower being more preferred. No preference is implied between two creator
-# types with the same integer value.
-CREATOR_TYPES = {
- "artist": 0,
- "artist/maker": 0,
- "attributed to": 0,
- "author": 0,
- "created_by": 0,
- "creator": 0,
- "created by": 0,
- "model maker": 0,
- "modeler": 0,
- "photographer": 0,
- "photograph by": 0,
- "written by": 0,
- "architect": 1,
- "designer": 1,
- "designed by": 1,
- "illustrator": 1,
- "illustrated by": 1,
- "cartoonist": 1,
- "weaver": 1,
- "composer": 1,
- "composed by": 1,
- "embroiderer": 1,
- "landscape architect": 1,
- "calligrapher": 1,
- "sculptor": 1,
- "jeweler": 1,
- "potter": 1,
- "ceramist": 1,
- "compiled by": 2,
- "engraver": 2,
- "etcher": 2,
- "maker": 2,
- "silversmith": 2,
- "producer": 2,
- "produced by": 2,
- "metal worker": 2,
- "carver": 2,
- "cartographer": 2,
- "print maker": 3,
- "painter": 3,
- "after": 3,
- "inventor": 3,
- "lithographer": 3,
- "attribution": 3,
- "former attribution": 3,
- "manufactured by": 4,
- "manufacturer": 4,
- "published by": 4,
- "publisher": 4,
- "editor": 4,
- "patentee": 5,
- "collector": 6,
-}
-
-DESCRIPTION_TYPES = {
- "description",
- "summary",
- "caption",
- "notes",
- "description (brief)",
- "description (spanish)",
- "description (brief spanish)",
- "gallery label",
- "exhibition label",
- "luce center label",
- "publication label",
- "new acquisition label",
-}
-TAG_TYPES = ("date", "object_type", "topic", "place")
-
-image_store = ImageStore(provider=PROVIDER)
-delayed_requester = DelayedRequester(delay=DELAY)
-def main():
- """
- This script loops through all hash prefixes of a specified length,
- gathering metadata for each prefix in turn. A 'hash prefix' is
- defined as a search query that finds all objects whose hash ID
- starts with some string of hexits of a specified length (e.g.,
- '0a2*' is a hash prefix of length 3).
-
- It fails early if the unit codes are not configured correctly.
- """
- validate_unit_codes_from_api()
- for hash_prefix in _get_hash_prefixes(HASH_PREFIX_LENGTH):
- total_rows = _process_hash_prefix(hash_prefix)
- logger.info(f"Total rows for {hash_prefix}: {total_rows}")
- total_images = image_store.commit()
- logger.info(f"Total images: {total_images}")
-
-
-def gather_samples(
- units_endpoint=UNITS_ENDPOINT, default_query_params=None, target_dir="/tmp"
-):
- """
- Gather random samples of the rows from each 'unit' at the SI.
-
- These units are treated separately since they have somewhat
- different data formats.
-
- This function is for gathering test data only, and is untested.
- """
- if default_query_params is None:
- default_query_params = DEFAULT_PARAMS
- query_params = default_query_params.copy()
- now_str = datetime.strftime(datetime.now(), "%Y%m%d%H%M%S")
- sample_dir = os.path.join(target_dir, f"si_samples_{now_str}")
- logger.info(f"Creating sample_dir {sample_dir}")
- os.mkdir(sample_dir)
- unit_code_json = delayed_requester.get_response_json(
- units_endpoint, query_params=query_params
- )
- unit_code_list = unit_code_json.get("response", {}).get("terms", [])
- logger.info(f"found unit codes: {unit_code_list}")
- for unit in unit_code_list:
- _gather_unit_sample(unit, sample_dir)
-
-
-def _gather_unit_sample(unit, sample_dir, retries=RETRIES, endpoint=SEARCH_ENDPOINT):
- """
- This function is for gathering test data only, and is untested.
- """
- logger.info(f"gathering sample for unit {unit}")
- for hash_prefix in [None, "a", "aa", "aaa", "aaaa", "aaaaa"]:
- query_params = _build_query_params(0, hash_prefix=hash_prefix, unit_code=unit)
- response_json = delayed_requester.get_response_json(
- endpoint, retries=retries, query_params=query_params
- )
- if response_json is None:
- logger.warning(f"response_json is NoneType for {unit}")
- break
- elif response_json["response"]["rowCount"] == 0:
- logger.info(f"No rows found for unit_code {unit} with hash {hash_prefix}")
- break
- elif response_json["response"]["rowCount"] > 10000:
- logger.info(f'Too many rows: {response_json["response"]["rowCount"]}')
- else:
- total_rows = response_json["response"]["rowCount"]
- saved_rows = min(total_rows, 1000)
- logger.info(f"Saving {saved_rows} of {total_rows} rows")
- with open(os.path.join(sample_dir, f"{unit}.json"), "w") as f:
- f.write(json.dumps(response_json, indent=2))
- break
-
-
-def get_new_and_outdated_unit_codes(
- unit_codes_from_api: set, sub_providers: dict = SUB_PROVIDERS
-) -> Tuple[set, set]:
- current_unit_codes = set().union(*sub_providers.values())
-
- new_unit_codes = unit_codes_from_api - current_unit_codes
- outdated_unit_codes = current_unit_codes - unit_codes_from_api
-
- return new_unit_codes, outdated_unit_codes
-
-
-@retry(ValueError, tries=3, delay=1, backoff=2)
-def get_unit_codes_from_api(
- units_endpoint: str = UNITS_ENDPOINT, retries: int = 3
-) -> set:
- query_params = {"api_key": API_KEY, "q": "online_media_type:Images"}
- response_json = delayed_requester.get_response_json(
- units_endpoint, query_params=query_params
- )
- unit_codes_from_api = set(response_json.get("response", {}).get("terms", []))
-
- if len(unit_codes_from_api) == 0:
- raise ValueError("No unit codes received.")
-
- return unit_codes_from_api
-
-
-def validate_unit_codes_from_api(units_endpoint: str = UNITS_ENDPOINT) -> None:
- """
- Validates the SMITHSONIAN_SUB_PROVIDERS dictionary, and raises an exception if
- human intervention is needed to add or remove unit codes.
- """
- unit_codes_from_api = get_unit_codes_from_api(units_endpoint)
- new_unit_codes, outdated_unit_codes = get_new_and_outdated_unit_codes(
- unit_codes_from_api
- )
-
- if bool(new_unit_codes) or bool(outdated_unit_codes):
- message = "\n*Updates needed to the SMITHSONIAN_SUB_PROVIDERS dictionary*:\n\n"
-
- if bool(new_unit_codes):
- codes_string = "\n".join(f" - `{code}`" for code in new_unit_codes)
- message += "New unit codes must be added:\n"
- message += codes_string
- message += "\n"
-
- if bool(outdated_unit_codes):
- codes_string = "\n".join(f" - `{code}`" for code in outdated_unit_codes)
- message += "Outdated unit codes must be deleted:\n"
- message += codes_string
-
- logger.info(message)
- raise AirflowException(message)
-
-
-def _get_hash_prefixes(prefix_length):
- max_prefix = "f" * prefix_length
- format_string = f"0{prefix_length}x"
- for h in range(int(max_prefix, 16) + 1):
- yield format(h, format_string)
-
-
-def _process_hash_prefix(
- hash_prefix, endpoint=SEARCH_ENDPOINT, limit=LIMIT, retries=RETRIES
-):
- logger.info(f"Processing hash_prefix: {hash_prefix}")
- total_images = 0
- row_offset = 0
- total_rows = 1
- while row_offset < total_rows:
- logger.debug(f"Row offset: {row_offset}")
- query_params = _build_query_params(row_offset, hash_prefix=hash_prefix)
- response_json = delayed_requester.get_response_json(
- endpoint, retries=retries, query_params=query_params
- )
- if response_json is None:
- logger.warning("response_json is None! Continuing...")
- else:
- new_total = _process_response_json(response_json)
- total_images = new_total if new_total is not None else total_images
- logger.info(f"Total images so far: {total_images}")
- total_rows = response_json.get("response", {}).get("rowCount", 0)
- row_offset += limit
- return total_rows
-
-
-def _build_query_params(
- row_offset, hash_prefix=None, default_params=None, unit_code=None
-):
- if default_params is None:
- default_params = DEFAULT_PARAMS
- query_params = default_params.copy()
- query_string = "online_media_type:Images AND media_usage:CC0"
- if hash_prefix is not None:
- query_string += f" AND hash:{hash_prefix}*"
- if unit_code is not None:
- query_string += f" AND unit_code:{unit_code}"
- query_params.update(q=query_string, start=row_offset)
- return query_params
-
-
-def _process_response_json(response_json):
- logger.debug("processing response")
- total_images = None
- rows = _get_row_list(response_json)
- for row in rows:
- image_list = _get_image_list(row)
- if image_list:
- meta_data = _extract_meta_data(row)
- source = _extract_source(meta_data)
- total_images = _process_image_list(
- image_list,
- _get_foreign_landing_url(row),
- _get_title(row),
- _get_creator(row),
- meta_data,
- _extract_tags(row),
- source,
- )
- return total_images
-
+class SmithsonianDataIngester(ProviderDataIngester):
+ providers = {"image": prov.SMITHSONIAN_DEFAULT_PROVIDER}
+ sub_providers = prov.SMITHSONIAN_SUB_PROVIDERS
+ base_endpoint = "https://api.si.edu/openaccess/api/v1.0/"
+ endpoint = f"{base_endpoint}search"
+ delay = 5.0
+ batch_limit = 1000
+ hash_prefix_length = 2
+ description_types = {
+ "description",
+ "summary",
+ "caption",
+ "notes",
+ "description (brief)",
+ "description (spanish)",
+ "description (brief spanish)",
+ "gallery label",
+ "exhibition label",
+ "luce center label",
+ "publication label",
+ "new acquisition label",
+ }
-def _get_row_list(response_json):
- return _check_type(response_json.get("response", {}).get("rows"), list)
+ # `creator_types` should have lower-case strings as keys, and integers as values.
+ # The integers given the preference order of the different creator types, with
+ # lower being more preferred. No preference is implied between two creator
+ # types with the same integer value.
+ creator_types = {
+ "artist": 0,
+ "artist/maker": 0,
+ "attributed to": 0,
+ "author": 0,
+ "created_by": 0,
+ "creator": 0,
+ "created by": 0,
+ "model maker": 0,
+ "modeler": 0,
+ "photographer": 0,
+ "photograph by": 0,
+ "written by": 0,
+ "architect": 1,
+ "designer": 1,
+ "designed by": 1,
+ "illustrator": 1,
+ "illustrated by": 1,
+ "cartoonist": 1,
+ "weaver": 1,
+ "composer": 1,
+ "composed by": 1,
+ "embroiderer": 1,
+ "landscape architect": 1,
+ "calligrapher": 1,
+ "sculptor": 1,
+ "jeweler": 1,
+ "potter": 1,
+ "ceramist": 1,
+ "compiled by": 2,
+ "engraver": 2,
+ "etcher": 2,
+ "maker": 2,
+ "silversmith": 2,
+ "producer": 2,
+ "produced by": 2,
+ "metal worker": 2,
+ "carver": 2,
+ "cartographer": 2,
+ "print maker": 3,
+ "painter": 3,
+ "after": 3,
+ "inventor": 3,
+ "lithographer": 3,
+ "attribution": 3,
+ "former attribution": 3,
+ "manufactured by": 4,
+ "manufacturer": 4,
+ "published by": 4,
+ "publisher": 4,
+ "editor": 4,
+ "patentee": 5,
+ "collector": 6,
+ }
+ tag_types = ("date", "object_type", "topic", "place")
-def _get_image_list(row):
- dnr_dict = _get_descriptive_non_repeating_dict(row)
- online_media = _check_type(dnr_dict.get("online_media"), dict)
- return _check_type(online_media.get("media"), list)
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.api_key = Variable.get("API_KEY_DATA_GOV")
+ self.units_endpoint = f"{self.base_endpoint}terms/unit_code"
+ self.license_info = get_license_info(
+ license_url="https://creativecommons.org/publicdomain/zero/1.0/"
+ )
+ def get_media_type(self, record: dict) -> str:
+ return constants.IMAGE
+
+ def get_next_query_params(self, prev_query_params: dict | None, **kwargs) -> dict:
+ # On the first request, `prev_query_params` will be `None`. We can detect this
+ # and return our default params.
+ query_string = "online_media_type:Images AND media_usage:CC0"
+ if hash_prefix := kwargs.get("hash_prefix"):
+ query_string += f" AND hash:{hash_prefix}*"
+
+ if not prev_query_params:
+ return {
+ "api_key": self.api_key,
+ "q": query_string,
+ "rows": self.batch_limit,
+ "start": 0,
+ }
+ else:
+ return {
+ **prev_query_params,
+ "start": prev_query_params["start"] + self.batch_limit,
+ }
+
+ def get_batch_data(self, response_json) -> list | None:
+ # Takes the raw API response from calling `get` on the endpoint, and returns
+ # the list of records to process.
+ if response_json:
+ rows = response_json.get("response", {}).get("rows")
+ return self._check_type(rows, list)
+ return None
+
+ def get_record_data(self, data: dict) -> dict | list[dict] | None:
+ # Parse out the necessary info from the record data into a dictionary.
+ images = []
+ if image_list := self._get_image_list(data):
+
+ if (foreign_landing_url := self._get_foreign_landing_url(data)) is None:
+ return None
+
+ meta_data = self._extract_meta_data(data)
+ shared_image_data = {
+ "foreign_landing_url": foreign_landing_url,
+ "title": data.get("title"),
+ "license_info": self.license_info,
+ "source": self._extract_source(meta_data),
+ "creator": self._get_creator(data),
+ "meta_data": meta_data,
+ "raw_tags": self._extract_tags(data),
+ # TODO: Check if the following columns can be filled.
+ # creator_url
+ # thumbnail_url
+ # filesize
+ # filetype
+ # category
+ # watermarked
+ }
+ images += self._get_associated_images(image_list, shared_image_data)
+ return images
+
+ @retry(ValueError, tries=3, delay=1, backoff=2)
+ def _get_unit_codes_from_api(self) -> set:
+ query_params = {"api_key": self.api_key, "q": "online_media_type:Images"}
+ response_json = self.get_response_json(
+ endpoint=self.units_endpoint, query_params=query_params
+ )
+ unit_codes_from_api = set(response_json.get("response", {}).get("terms", []))
+
+ if len(unit_codes_from_api) == 0:
+ raise ValueError("No unit codes received")
+
+ logger.debug(f"\nUnit codes received:\n{unit_codes_from_api}\n")
+ return unit_codes_from_api
+
+ def _get_new_and_outdated_unit_codes(
+ self, unit_codes_from_api: set
+ ) -> Tuple[set, set]:
+ current_unit_codes = set().union(*self.sub_providers.values())
+ new_unit_codes = unit_codes_from_api - current_unit_codes
+ outdated_unit_codes = current_unit_codes - unit_codes_from_api
+ return new_unit_codes, outdated_unit_codes
+
+ def validate_unit_codes_from_api(self) -> None:
+ """
+ Validates the SMITHSONIAN_SUB_PROVIDERS dictionary, and raises an exception if
+ human intervention is needed to add or remove unit codes.
+ """
+ logger.info("Validating Smithsonian sub-providers...")
+ unit_codes_from_api = self._get_unit_codes_from_api()
+ new_unit_codes, outdated_unit_codes = self._get_new_and_outdated_unit_codes(
+ unit_codes_from_api
+ )
-def _get_foreign_landing_url(row):
- logger.debug("Getting foreign_landing_url from row")
- dnr_dict = _get_descriptive_non_repeating_dict(row)
- foreign_landing_url = dnr_dict.get("record_link")
- if foreign_landing_url is None:
- foreign_landing_url = dnr_dict.get("guid")
+ if bool(new_unit_codes) or bool(outdated_unit_codes):
+ message = (
+ "\n*Updates needed to the SMITHSONIAN_SUB_PROVIDERS dictionary*:\n\n"
+ )
- return foreign_landing_url
+ if bool(new_unit_codes):
+ codes_string = "\n".join(f" - `{code}`" for code in new_unit_codes)
+ message += "New unit codes must be added:\n"
+ message += codes_string
+ message += "\n"
+
+ if bool(outdated_unit_codes):
+ codes_string = "\n".join(
+ f" - `{code}`" for code in outdated_unit_codes
+ )
+ message += "Outdated unit codes must be deleted:\n"
+ message += codes_string
+
+ logger.info(message)
+ raise AirflowException(message)
+
+ def _get_hash_prefixes(self):
+ max_prefix = "f" * self.hash_prefix_length
+ format_string = f"0{self.hash_prefix_length}x"
+ for h in range(int(max_prefix, 16) + 1):
+ yield format(h, format_string)
+
+ @staticmethod
+ def _check_type(unknown_input, required_type):
+ """
+ This function ensures that the input is of the required type.
+
+ Required Arguments:
+
+ unknown_input: This can be anything
+ required_type: built-in type name/constructor
+
+ This function will check whether the unknown_input is of type
+ required_type. If it is, it returns the unknown_input value
+ unchanged. If not, will return the DEFAULT VALUE FOR THE TYPE
+ required_type. So, if unknown_input is a float 3.0 and the
+ required_type is int, this function will return 0.
+
+ This function will work for required_type in:
+ str, int, float, complex, list, tuple, dict, set, bool, and bytes.
+
+ This function will create a relatively high-level log message
+ whenever it has to initialize a default value for type
+ required_type.
+ """
+ logger.debug(f"Ensuring {unknown_input} is of type {required_type}")
+ if unknown_input is None:
+ logger.debug(f"{unknown_input} is of type {type(unknown_input)}.")
+ typed_input = required_type()
+ elif type(unknown_input) != required_type:
+ logger.info(
+ f"{unknown_input} is of type {type(unknown_input)}"
+ f" rather than {required_type}."
+ )
+ typed_input = required_type()
+ else:
+ typed_input = unknown_input
+ return typed_input
+
+ def _get_content_dict(self, row, field):
+ logger.debug(f"Getting `{field}` from row")
+ content = self._check_type(row.get("content"), dict)
+ return self._check_type(content.get(field), dict)
+
+ def _get_image_list(self, row):
+ dnr_dict = self._get_content_dict(row, "descriptiveNonRepeating")
+ online_media = self._check_type(dnr_dict.get("online_media"), dict)
+ return self._check_type(online_media.get("media"), list)
+
+ @staticmethod
+ def _get_associated_images(image_list, partial_image_data: dict) -> list:
+ images = []
+ for image_data in image_list:
+ usage = image_data.get("usage", {}).get("access")
+ if image_data.get("type") != "Images" or usage != "CC0":
+ continue
+
+ if (image_url := image_data.get("content")) is None:
+ continue
+
+ if (foreign_identifier := image_data.get("idsId")) is None:
+ continue
+
+ images.append(
+ {
+ **partial_image_data,
+ "image_url": image_url,
+ "foreign_identifier": foreign_identifier,
+ }
+ )
+ return images
+ def _get_foreign_landing_url(self, row):
+ logger.debug("Getting foreign_landing_url from row")
+ dnr_dict = self._get_content_dict(row, "descriptiveNonRepeating")
+ foreign_landing_url = dnr_dict.get("record_link")
+ if foreign_landing_url is None:
+ foreign_landing_url = dnr_dict.get("guid")
-def _get_title(row):
- return row.get("title")
+ return foreign_landing_url
+ def _extract_meta_data(self, row) -> dict:
+ freetext = self._get_content_dict(row, "freetext")
+ descriptive_non_repeating = self._get_content_dict(
+ row, "descriptiveNonRepeating"
+ )
+ description, label_texts = "", ""
+ notes = self._check_type(freetext.get("notes"), list)
+
+ for note in notes:
+ label = self._check_type(note.get("label", ""), str)
+ if label.lower().strip() in self.description_types:
+ description += " " + self._check_type(note.get("content", ""), str)
+ elif label.lower().strip() == "label text":
+ label_texts += " " + self._check_type(note.get("content", ""), str)
+
+ meta_data = {
+ "unit_code": descriptive_non_repeating.get("unit_code"),
+ "data_source": descriptive_non_repeating.get("data_source"),
+ }
+
+ if description:
+ meta_data.update(description=description.strip())
+ if label_texts:
+ meta_data.update(label_text=label_texts.strip())
+
+ return {k: v for (k, v) in meta_data.items() if v is not None}
+
+ def _extract_source(self, meta_data):
+ unit_code = meta_data.get("unit_code").strip()
+ source = next(
+ (s for s in self.sub_providers if unit_code in self.sub_providers[s]), None
+ )
+ if source is None:
+ raise Exception(f"An unknown unit code value {unit_code} encountered ")
+ return source
+
+ def _get_creator(self, row):
+ freetext = self._get_content_dict(row, "freetext")
+ indexed_structured = self._get_content_dict(row, "indexedStructured")
+ ordered_freetext_creator_objects = sorted(
+ [
+ i
+ for i in self._check_type(freetext.get("name"), list)
+ if type(i) == dict
+ and (
+ self._check_type(i.get("label"), str).lower() in self.creator_types
+ )
+ and (self._check_type(i.get("content"), str))
+ and ("unknown" not in i.get("content").lower())
+ ],
+ key=lambda x: self.creator_types[x["label"].lower()],
+ )
-def _get_creator(row, creator_types=None):
- if creator_types is None:
- creator_types = CREATOR_TYPES.copy()
- freetext = _get_freetext_dict(row)
- indexed_structured = _get_indexed_structured_dict(row)
- ordered_freetext_creator_objects = sorted(
- [
- i
- for i in _check_type(freetext.get("name"), list)
+ indexed_structured_creator_generator = (
+ i["content"]
+ for i in self._check_type(indexed_structured.get("name"), list)
if type(i) == dict
- and (_check_type(i.get("label"), str).lower() in creator_types)
- and (_check_type(i.get("content"), str))
- and ("unknown" not in i.get("content").lower())
- ],
- key=lambda x: creator_types[x["label"].lower()],
- )
-
- indexed_structured_creator_generator = (
- i["content"]
- for i in _check_type(indexed_structured.get("name"), list)
- if type(i) == dict
- and (_check_type(i.get("type"), str).lower() == "personal_main")
- and (_check_type(i.get("content"), str))
- )
-
- if ordered_freetext_creator_objects:
- first_creator_object = ordered_freetext_creator_objects[0]
- top_priority = creator_types[first_creator_object["label"].lower()]
-
- creators_list = [
- c["content"]
- for c in ordered_freetext_creator_objects
- if top_priority == creator_types[c["label"].lower()]
- ]
-
- creator = (
- "; ".join(creators_list[:-1]) + " and " + creators_list[-1]
- if len(creators_list) > 1
- else creators_list[0]
+ and (self._check_type(i.get("type"), str).lower() == "personal_main")
+ and (self._check_type(i.get("content"), str))
)
- else:
- creator = None
-
- if creator is None:
- logger.debug(f"No creator found in freetext: {freetext}")
- creator = next(indexed_structured_creator_generator, None)
- if creator is None:
- logger.debug(f"No creator found in indexed_structured: {indexed_structured}")
- return creator
-
-
-def _extract_meta_data(row, description_types=None):
- if description_types is None:
- description_types = DESCRIPTION_TYPES.copy()
- freetext = _get_freetext_dict(row)
- descriptive_non_repeating = _get_descriptive_non_repeating_dict(row)
- description = ""
- label_texts = ""
- notes = _check_type(freetext.get("notes"), list)
-
- for note in notes:
- label = _check_type(note.get("label", ""), str)
- if label.lower().strip() in description_types:
- description += " " + _check_type(note.get("content", ""), str)
- elif label.lower().strip() == "label text":
- label_texts += " " + _check_type(note.get("content", ""), str)
-
- meta_data = {
- "unit_code": descriptive_non_repeating.get("unit_code"),
- "data_source": descriptive_non_repeating.get("data_source"),
- }
+ if ordered_freetext_creator_objects:
+ first_creator_object = ordered_freetext_creator_objects[0]
+ top_priority = self.creator_types[first_creator_object["label"].lower()]
- if description:
- meta_data.update(description=description.strip())
- if label_texts:
- meta_data.update(label_text=label_texts.strip())
+ creators_list = [
+ c["content"]
+ for c in ordered_freetext_creator_objects
+ if top_priority == self.creator_types[c["label"].lower()]
+ ]
- return {k: v for (k, v) in meta_data.items() if v is not None}
-
-
-def _extract_source(meta_data, sub_providers=SUB_PROVIDERS):
- unit_code = meta_data.get("unit_code").strip()
- source = next((s for s in sub_providers if unit_code in sub_providers[s]), None)
- if source is None:
- raise Exception(f"An unknown unit code value {unit_code} encountered ")
- return source
-
-
-def _extract_tags(row, tag_types=None):
- if tag_types is None:
- tag_types = TAG_TYPES
- indexed_structured = _get_indexed_structured_dict(row)
- tag_lists_generator = (
- _check_type(indexed_structured.get(key), list) for key in tag_types
- )
- return [tag for tag_list in tag_lists_generator for tag in tag_list if tag]
-
-
-def _get_descriptive_non_repeating_dict(row):
- logger.debug("Getting descriptive_non_repeating_dict from row")
- return _check_type(_get_content_dict(row).get("descriptiveNonRepeating"), dict)
-
-
-def _get_indexed_structured_dict(row):
- logger.debug("Getting indexed_structured_dict from row")
- return _check_type(_get_content_dict(row).get("indexedStructured"), dict)
-
-
-def _get_freetext_dict(row):
- logger.debug("Getting freetext_dict from row")
- return _check_type(_get_content_dict(row).get("freetext"), dict)
-
-
-def _get_content_dict(row):
- return _check_type(row.get("content"), dict)
-
-
-def _check_type(unknown_input, required_type):
- """
- This function ensures that the input is of the required type.
+ creator = (
+ "; ".join(creators_list[:-1]) + " and " + creators_list[-1]
+ if len(creators_list) > 1
+ else creators_list[0]
+ )
- Required Arguments:
+ else:
+ creator = None
+
+ if creator is None:
+ logger.debug(f"No creator found in freetext: {freetext}")
+ creator = next(indexed_structured_creator_generator, None)
+ if creator is None:
+ logger.debug(
+ f"No creator found in indexed_structured: {indexed_structured}"
+ )
+ return creator
- unknown_input: This can be anything
- required_type: built-in type name/constructor
+ def _extract_tags(self, row):
+ indexed_structured = self._get_content_dict(row, "indexedStructured")
+ tag_lists_generator = (
+ self._check_type(indexed_structured.get(key), list)
+ for key in self.tag_types
+ )
+ return [tag for tag_list in tag_lists_generator for tag in tag_list if tag]
- This function will check whether the unknown_input is of type
- required_type. If it is, it returns the unknown_input value
- unchanged. If not, will return the DEFAULT VALUE FOR THE TYPE
- required_type. So, if unknown_input is a float 3.0 and the
- required_type is int, this function will return 0.
+ def ingest_records(self, **kwargs) -> None:
+ self.validate_unit_codes_from_api()
+ for hash_prefix in self._get_hash_prefixes():
+ logger.debug(f"Getting records for hash prefix {hash_prefix}")
+ super().ingest_records(hash_prefix=hash_prefix)
- This function will work for required_type in:
- str, int, float, complex, list, tuple, dict, set, bool, and bytes.
- This function will create a relatively high-level log message
- whenever it has to initialize a default value for type
- required_type.
- """
- logger.debug(f"Ensuring {unknown_input} is of type {required_type}")
- if unknown_input is None:
- logger.debug(f"{unknown_input} is of type {type(unknown_input)}.")
- typed_input = required_type()
- elif type(unknown_input) != required_type:
- logger.info(
- f"{unknown_input} is of type {type(unknown_input)}"
- f" rather than {required_type}."
- )
- typed_input = required_type()
- else:
- typed_input = unknown_input
- return typed_input
-
-
-def _process_image_list(
- image_list,
- foreign_landing_url,
- title,
- creator,
- meta_data,
- tags,
- source,
- license_url=ZERO_URL,
-):
- total_images = None
- for image_data in image_list:
- if (
- image_data.get("type") == "Images"
- and image_data.get("usage", {}).get("access") == "CC0"
- ):
- total_images = image_store.add_item(
- foreign_landing_url=foreign_landing_url,
- image_url=image_data.get("content"),
- license_info=LicenseInfo(
- "cc0",
- "1.0",
- "https://creativecommons.org/publicdomain/zero/1.0/",
- license_url,
- ),
- foreign_identifier=image_data.get("idsId"),
- title=title,
- creator=creator,
- meta_data=meta_data,
- raw_tags=tags,
- source=source,
- )
- return total_images
+def main():
+ ingester = SmithsonianDataIngester()
+ ingester.ingest_records()
if __name__ == "__main__":
diff --git a/openverse_catalog/dags/providers/provider_workflows.py b/openverse_catalog/dags/providers/provider_workflows.py
index 3a119be79..3944286e7 100644
--- a/openverse_catalog/dags/providers/provider_workflows.py
+++ b/openverse_catalog/dags/providers/provider_workflows.py
@@ -17,6 +17,7 @@ from providers.provider_api_scripts.phylopic import PhylopicDataIngester
from providers.provider_api_scripts.provider_data_ingester import ProviderDataIngester
from providers.provider_api_scripts.rawpixel import RawpixelDataIngester
from providers.provider_api_scripts.science_museum import ScienceMuseumDataIngester
+from providers.provider_api_scripts.smithsonian import SmithsonianDataIngester
from providers.provider_api_scripts.smk import SmkDataIngester
from providers.provider_api_scripts.stocksnap import StockSnapDataIngester
from providers.provider_api_scripts.wikimedia_commons import (
@@ -202,6 +203,7 @@ PROVIDER_WORKFLOWS = [
),
ProviderWorkflow(
provider_script="smithsonian",
+ ingestion_callable=SmithsonianDataIngester,
start_date=datetime(2020, 1, 1),
schedule_string="@weekly",
load_timeout=timedelta(hours=4),
diff --git a/tests/dags/providers/provider_api_scripts/resources/smithsonian/actual_record_data.json b/tests/dags/providers/provider_api_scripts/resources/smithsonian/actual_record_data.json
new file mode 100644
index 000000000..8844fe432
--- /dev/null
+++ b/tests/dags/providers/provider_api_scripts/resources/smithsonian/actual_record_data.json
@@ -0,0 +1,201 @@
+{
+ "content": {
+ "descriptiveNonRepeating": {
+ "data_source": "NMNH - Vertebrate Zoology - Birds Division",
+ "guid": "http://n2t.net/ark:/65665/34857ca78-9195-4156-849b-1ec47f7cd1ce",
+ "metadata_usage": {
+ "access": "CC0"
+ },
+ "online_media": {
+ "media": [
+ {
+ "content": "https://collections.nmnh.si.edu/media/?irn=15814382",
+ "guid": "http://n2t.net/ark:/65665/m36e850c7c-c23c-442a-a13d-6a9c4fc3da31",
+ "idsId": "https://collections.nmnh.si.edu/media/?irn=15814382",
+ "thumbnail": "https://collections.nmnh.si.edu/media/?irn=15814382&thumb=yes",
+ "type": "Images",
+ "usage": {
+ "access": "CC0"
+ }
+ }
+ ],
+ "mediaCount": 1
+ },
+ "record_ID": "nmnhvz_14800560",
+ "record_link": "http://n2t.net/ark:/65665/34857ca78-9195-4156-849b-1ec47f7cd1ce",
+ "title": {
+ "content": "Passerculus sandwichensis nevadensis",
+ "label": "title"
+ },
+ "title_sort": "PASSERCULUS SANDWICHENSIS NEVADENSIS",
+ "unit_code": "NMNHBIRDS"
+ },
+ "freetext": {
+ "dataSource": [
+ {
+ "content": "NMNH - Vertebrate Zoology - Birds Division",
+ "label": "Data Source"
+ }
+ ],
+ "date": [
+ {
+ "content": "22 Apr 1958",
+ "label": "Collection Date"
+ }
+ ],
+ "identifier": [
+ {
+ "content": "000000",
+ "label": "Accession Number"
+ },
+ {
+ "content": "Field Number : 795",
+ "label": "Other Numbers"
+ },
+ {
+ "content": "466243",
+ "label": "USNM Number"
+ }
+ ],
+ "name": [
+ {
+ "content": "Seymour H. Levy",
+ "label": "Collector"
+ }
+ ],
+ "notes": [
+ {
+ "content": "30 Mar 2022",
+ "label": "Record Last Modified"
+ },
+ {
+ "content": "1",
+ "label": "Specimen Count"
+ }
+ ],
+ "physicalDescription": [
+ {
+ "content": "Skin: Whole",
+ "label": "Preparation"
+ },
+ {
+ "content": "Female",
+ "label": "Sex"
+ }
+ ],
+ "place": [
+ {
+ "content": "Picacho Reservation, Pinal, Arizona, United States, North America",
+ "label": "Place"
+ }
+ ],
+ "publisher": [
+ {
+ "content": "Passerculus sandwichensis nevadensis",
+ "label": "Published Name"
+ }
+ ],
+ "setName": [
+ {
+ "content": "Vertebrate Zoology",
+ "label": "See more items in"
+ },
+ {
+ "content": "Birds",
+ "label": "See more items in"
+ }
+ ],
+ "taxonomicName": [
+ {
+ "content": "Savannah Sparrow",
+ "label": "Common name"
+ },
+ {
+ "content": "Savannah Sparrow (Ipswich)",
+ "label": "Common name"
+ },
+ {
+ "content": "Animalia, Chordata, Vertebrata, Aves, Passeriformes, Emberizidae, Emberizinae",
+ "label": "Taxonomy"
+ }
+ ]
+ },
+ "indexedStructured": {
+ "common_name": [
+ "Savannah Sparrow",
+ "Savannah Sparrow (Ipswich)"
+ ],
+ "date": [
+ "1950s"
+ ],
+ "geoLocation": [
+ {
+ "L1": {
+ "content": "North America",
+ "type": "Continent"
+ },
+ "L2": {
+ "content": "United States",
+ "type": "Country"
+ },
+ "L3": {
+ "content": "Arizona",
+ "type": "State"
+ },
+ "L4": {
+ "content": "Pinal",
+ "type": "County"
+ },
+ "Other": {
+ "content": "Picacho Reservation",
+ "type": "Locality"
+ }
+ }
+ ],
+ "name": [
+ "Levy, S. H."
+ ],
+ "online_media_type": [
+ "Images"
+ ],
+ "place": [
+ "United States",
+ "Pinal",
+ "North America",
+ "Arizona"
+ ],
+ "scientific_name": [
+ "Passerculus sandwichensis nevadensis"
+ ],
+ "tax_class": [
+ "Aves"
+ ],
+ "tax_family": [
+ "Emberizidae"
+ ],
+ "tax_kingdom": [
+ "Animalia"
+ ],
+ "tax_order": [
+ "Passeriformes"
+ ],
+ "tax_phylum": [
+ "Chordata"
+ ],
+ "topic": [
+ "Animals",
+ "Birds"
+ ]
+ }
+ },
+ "docSignature": "860718e6b8703c3c798bb9b800842061",
+ "hash": "0106b9f4bbe0ea07807a6ab275d6fc83dd90092f",
+ "id": "ld1-1643414028222-1643414062574-0",
+ "lastTimeUpdated": "1653672694",
+ "timestamp": "1653672694",
+ "title": "Passerculus sandwichensis nevadensis",
+ "type": "edanmdm",
+ "unitCode": "NMNHBIRDS",
+ "url": "edanmdm:nmnhvz_14800560",
+ "version": ""
+}
diff --git a/tests/dags/providers/provider_api_scripts/resources/smithsonian/actual_response.json b/tests/dags/providers/provider_api_scripts/resources/smithsonian/actual_response.json
deleted file mode 100644
index 5bcedbc4f..000000000
--- a/tests/dags/providers/provider_api_scripts/resources/smithsonian/actual_response.json
+++ /dev/null
@@ -1,1798 +0,0 @@
-{
- "response": {
- "message": "content found",
- "rowCount": 734,
- "rows": [
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "Smithsonian Institution Archives",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService?id=SIA-SIA2010-2358",
- "idsId": "SIA-SIA2010-2358",
- "thumbnail": "https://ids.si.edu/ids/deliveryService?id=SIA-SIA2010-2358&max=150",
- "type": "Images",
- "usage": {
- "access": "CC0",
- "text": ""
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "siris_arc_291918",
- "title": {
- "content": "Views of the National Zoological Park in Washington, DC, showing Elephant",
- "label": "Title"
- },
- "title_sort": "VIEWS OF THE NATIONAL ZOOLOGICAL PARK IN WASHINGTON DC SHOWING ELEPHANT",
- "unit_code": "SIA"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "Smithsonian Institution Archives",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "1919",
- "label": "Date"
- },
- {
- "content": "C. 1920-1924",
- "label": "Date"
- }
- ],
- "identifier": [
- {
- "content": "SIA RU007355 [SIA2010-2358]",
- "label": "Local number"
- }
- ],
- "name": [
- {
- "content": "Gruber, Martin A",
- "label": "Creator"
- },
- {
- "content": "National Zoological Park (U.S.)",
- "label": "Subject"
- }
- ],
- "notes": [
- {
- "content": "Smithsonian Institution Archives, Record Unit 7355, Martin A. Gruber Photograph Collection, Image No. SIA2010-2358",
- "label": "Cite as"
- },
- {
- "content": "Smithsonian Institution Archives, Capital Gallery, Suite 3000, MRC 507; 600 Maryland Avenue, SW; Washington, DC 20024-2520",
- "label": "Repository Loc."
- }
- ],
- "objectRights": [
- {
- "content": "No access restrictions Many of SIA's holdings are located off-site, and advance notice is recommended to consult a collection. Please email the SIA Reference Team at [email protected]",
- "label": "Restrictions & Rights"
- },
- {
- "content": "No Copyright - United States",
- "label": "Restrictions & Rights"
- }
- ],
- "objectType": [
- {
- "content": "Black-and-white photographs",
- "label": "Type"
- }
- ],
- "topic": [
- {
- "content": "Animals",
- "label": "Topic"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1920s",
- "1910s"
- ],
- "name": [
- {
- "content": "Gruber, Martin A",
- "type": "personal_main"
- },
- {
- "content": "National Zoological Park (U.S.)",
- "type": "corporate_subj"
- }
- ],
- "object_type": [
- "Archival materials",
- "Photographs"
- ],
- "online_media_type": [
- "Images"
- ],
- "topic": [
- "Animals"
- ],
- "usage_flag": [
- "Personal Paper Deposit"
- ]
- }
- },
- "docSignature": "b943f314acfdbcd3ed740a1c4bb2774f1e0abc24_c58eacf430afa83b10f6a76fc64459d9",
- "hash": "fffe9e6a7103a3449d84f3acf75ae7260e1c0386",
- "id": "edanmdm-siris_arc_291918",
- "lastTimeUpdated": "1580116213",
- "timestamp": "1580116221",
- "title": "Views of the National Zoological Park in Washington, DC, showing Elephant",
- "type": "edanmdm",
- "unitCode": "SIA",
- "url": "edanmdm:siris_arc_291918",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "Smithsonian Institution Archives",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService?id=SIA-SIA2014-00676&max=1024",
- "idsId": "SIA-SIA2014-00676",
- "thumbnail": "https://ids.si.edu/ids/deliveryService?id=SIA-SIA2014-00676&max=150",
- "type": "Images",
- "usage": {
- "access": "CC0",
- "text": ""
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "siris_arc_368960",
- "title": {
- "content": "Robert Ridgway Bird Head Drawing #314",
- "label": "Title"
- },
- "title_sort": "ROBERT RIDGWAY BIRD HEAD DRAWING 314",
- "unit_code": "SIA"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "Smithsonian Institution Archives",
- "label": "Data Source"
- }
- ],
- "identifier": [
- {
- "content": "SIA RU007167 [SIA2014-00676]",
- "label": "Local number"
- }
- ],
- "name": [
- {
- "content": "Ridgway, Robert 1850-1929",
- "label": "Creator"
- }
- ],
- "notes": [
- {
- "content": "This drawing or engravings of bird heads was used in Spencer F. Baird, Thomas Mayo Brewer, and Robert Ridgway's, A History of North American Birds: Land Birds, 3 volumes (Boston: Little, Brown, and Company, 1874) and The Water Birds of North America: Memoirs of the Museum of Comparative Zoology at Harvard College, vols. XII-XIII (Boston: Little, Brown, and Company, 1884). Heads drawn by Ridgway and Henry W. Elliott.",
- "label": "Summary"
- },
- {
- "content": "Smithsonian Institution Archives, Record Unit 7167, Image No. SIA2014-00676",
- "label": "Cite as"
- },
- {
- "content": "Smithsonian Institution Archives Capital Gallery, Suite 3000, MRC 507; 600 Maryland Avenue, SW; Washington, DC 20024-2520",
- "label": "Repository Loc."
- }
- ],
- "objectRights": [
- {
- "content": "No access restrictions Many of SIA's holdings are located off-site, and advance notice is recommended to consult a collection. Please email the SIA Reference Team at [email protected]",
- "label": "Restrictions & Rights"
- },
- {
- "content": "No Copyright - United States",
- "label": "Restrictions & Rights"
- }
- ],
- "objectType": [
- {
- "content": "Drawings (visual works)",
- "label": "Type"
- }
- ]
- },
- "indexedStructured": {
- "name": [
- {
- "content": "Ridgway, Robert",
- "type": "personal_main"
- }
- ],
- "object_type": [
- "Archival materials",
- "Drawings"
- ],
- "online_media_type": [
- "Images"
- ]
- }
- },
- "docSignature": "8ecec3298e3a3be27851000cf92665755301e5e9_f6c5e6280738e7fb51d3f965107d5389",
- "hash": "fff60c8f7744112043aefddace72bd5d8be49cf3",
- "id": "edanmdm-siris_arc_368960",
- "lastTimeUpdated": "1580116213",
- "timestamp": "1580116221",
- "title": "Robert Ridgway Bird Head Drawing #314",
- "type": "edanmdm",
- "unitCode": "SIA",
- "url": "edanmdm:siris_arc_368960",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Vertebrate Zoology - Mammals Division",
- "guid": "http://n2t.net/ark:/65665/308a4e035-1493-4c97-b60f-9ae7eecfa06a",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3210a583da18545648754b98630c39922",
- "guid": "http://n2t.net/ark:/65665/m3210a583d-a185-4564-8754-b98630c39922",
- "idsId": "ark:/65665/m3210a583da18545648754b98630c39922",
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3210a583da18545648754b98630c39922/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhvz_7585998",
- "record_link": "http://n2t.net/ark:/65665/308a4e035-1493-4c97-b60f-9ae7eecfa06a",
- "title": {
- "content": "Saccopteryx bilineata",
- "label": "title"
- },
- "title_sort": "SACCOPTERYX BILINEATA",
- "unit_code": "NMNHMAMMALS"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Vertebrate Zoology - Mammals Division",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "20 Apr 2002",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "2030677",
- "label": "Accession Number"
- },
- {
- "content": "Mammals Field Number : NW 1127",
- "label": "Other Numbers"
- },
- {
- "content": "568481",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "N. Woodman",
- "label": "Collector"
- },
- {
- "content": "Ecological remarks by collector(s): no",
- "label": "Microhabitat Description"
- }
- ],
- "notes": [
- {
- "content": "5 Nov 2019",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "physicalDescription": [
- {
- "content": "Skin",
- "label": "Preparation"
- },
- {
- "content": "Skull",
- "label": "Preparation"
- },
- {
- "content": "Partial Skeleton",
- "label": "Preparation"
- },
- {
- "content": "Male",
- "label": "Sex"
- }
- ],
- "place": [
- {
- "content": "Cerro Del Tortuguero, Cave At Base Of Hill, Barra Del Tortuguero, Limon, Costa Rica, North America",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Saccopteryx bilineata",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Vertebrate Zoology",
- "label": "See more items in"
- },
- {
- "content": "Mammals",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Animalia, Chordata, Vertebrata, Mammalia, Eutheria, Chiroptera, Emballonuridae, Emballonurinae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "2000s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "North America",
- "type": "Continent"
- },
- "L2": {
- "content": "Costa Rica",
- "type": "Country"
- },
- "L3": {
- "content": "Limon",
- "type": "State"
- },
- "L4": {
- "content": "Barra Del Tortuguero",
- "type": "County"
- },
- "Other": {
- "content": "Cerro Del Tortuguero, Cave At Base Of Hill",
- "type": "Locality"
- },
- "points": {
- "point": {
- "latitude": {
- "content": "10.58",
- "type": "decimal"
- },
- "longitude": {
- "content": "-83.53",
- "type": "decimal"
- }
- }
- }
- }
- ],
- "name": [
- "Woodman, N."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "North America",
- "Costa Rica",
- "Limon",
- "Barra Del Tortuguero"
- ],
- "scientific_name": [
- "Saccopteryx bilineata"
- ],
- "tax_class": [
- "Mammalia"
- ],
- "tax_family": [
- "Emballonuridae"
- ],
- "tax_kingdom": [
- "Animalia"
- ],
- "tax_order": [
- "Chiroptera"
- ],
- "tax_phylum": [
- "Chordata"
- ],
- "topic": [
- "Animals",
- "Mammals"
- ]
- }
- },
- "docSignature": "733b1f9e1a4179ff297321c28fda4ca6b9a15d01_d1150487d06980178d80e58f63d227f5",
- "hash": "fff2dbd5b6b1cea1408aa34abb539d84c06aa25a",
- "id": "edanmdm-nmnhvz_7585998",
- "lastTimeUpdated": "1581942003",
- "timestamp": "1581942019",
- "title": "Saccopteryx bilineata",
- "type": "edanmdm",
- "unitCode": "NMNHMAMMALS",
- "url": "edanmdm:nmnhvz_7585998",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Vertebrate Zoology - Mammals Division",
- "guid": "http://n2t.net/ark:/65665/33c737bca-1478-48da-9872-4feefb4848ed",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3004abe7507dc497a8b79732358279b41",
- "guid": "http://n2t.net/ark:/65665/m3004abe75-07dc-497a-8b79-732358279b41",
- "idsId": "ark:/65665/m3004abe7507dc497a8b79732358279b41",
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3004abe7507dc497a8b79732358279b41/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhvz_7418573",
- "record_link": "http://n2t.net/ark:/65665/33c737bca-1478-48da-9872-4feefb4848ed",
- "title": {
- "content": "Sorex trowbridgii trowbridgii",
- "label": "title"
- },
- "title_sort": "SOREX TROWBRIDGII TROWBRIDGII",
- "unit_code": "NMNHMAMMALS"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Vertebrate Zoology - Mammals Division",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "6 Jul 1983",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "360548",
- "label": "Accession Number"
- },
- {
- "content": "Mammals Field Number : JAD 1608",
- "label": "Other Numbers"
- },
- {
- "content": "558493",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "J. A. Dragavon",
- "label": "Collector"
- }
- ],
- "notes": [
- {
- "content": "12 Nov 2019",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "physicalDescription": [
- {
- "content": "3.8 g",
- "label": "Weight - Specimen"
- },
- {
- "content": "110 mm",
- "label": "Length - Total"
- },
- {
- "content": "57 mm",
- "label": "Length - Tail"
- },
- {
- "content": "12 mm",
- "label": "Length - Hind Tarsus"
- },
- {
- "content": "6 mm",
- "label": "Length - Ear Notch"
- },
- {
- "content": "Skull",
- "label": "Preparation"
- },
- {
- "content": "Unknown",
- "label": "Sex"
- }
- ],
- "place": [
- {
- "content": "Carson, 8.5 Mi N, 1.5 Mi W, Skamania County, Washington, United States, North America",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Sorex trowbridgii trowbridgii",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Vertebrate Zoology",
- "label": "See more items in"
- },
- {
- "content": "Mammals",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Animalia, Chordata, Vertebrata, Mammalia, Eutheria, Soricomorpha, Soricidae, Soricinae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1980s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "North America",
- "type": "Continent"
- },
- "L2": {
- "content": "United States",
- "type": "Country"
- },
- "L3": {
- "content": "Washington",
- "type": "State"
- },
- "L4": {
- "content": "Skamania County",
- "type": "County"
- },
- "Other": {
- "content": "Carson, 8.5 Mi N, 1.5 Mi W",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Dragavon, J. A."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "United States",
- "Skamania County",
- "North America",
- "Washington"
- ],
- "scientific_name": [
- "Sorex trowbridgii trowbridgii"
- ],
- "tax_class": [
- "Mammalia"
- ],
- "tax_family": [
- "Soricidae"
- ],
- "tax_kingdom": [
- "Animalia"
- ],
- "tax_order": [
- "Soricomorpha"
- ],
- "tax_phylum": [
- "Chordata"
- ],
- "topic": [
- "Animals",
- "Mammals"
- ]
- }
- },
- "docSignature": "154a1a0c8effe96af895a1d465224dc7ea827698_c67d6e2e550d53087e4a4b4d5552dff8",
- "hash": "fffd2535c25099de9e9b67feb875425aa343a7ec",
- "id": "edanmdm-nmnhvz_7418573",
- "lastTimeUpdated": "1581942117",
- "timestamp": "1581942135",
- "title": "Sorex trowbridgii trowbridgii",
- "type": "edanmdm",
- "unitCode": "NMNHMAMMALS",
- "url": "edanmdm:nmnhvz_7418573",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Vertebrate Zoology - Mammals Division",
- "guid": "http://n2t.net/ark:/65665/35dea73bf-262b-4fe9-96fe-b12df70ed2c5",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3471ae67e590a427b9af07ca24f305559",
- "guid": "http://n2t.net/ark:/65665/m3471ae67e-590a-427b-9af0-7ca24f305559",
- "idsId": "ark:/65665/m3471ae67e590a427b9af07ca24f305559",
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3471ae67e590a427b9af07ca24f305559/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhvz_7377213",
- "record_link": "http://n2t.net/ark:/65665/35dea73bf-262b-4fe9-96fe-b12df70ed2c5",
- "title": {
- "content": "Carollia perspicillata",
- "label": "title"
- },
- "title_sort": "CAROLLIA PERSPICILLATA",
- "unit_code": "NMNHMAMMALS"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Vertebrate Zoology - Mammals Division",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "19 Mar 1972",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "309761",
- "label": "Accession Number"
- },
- {
- "content": "Mammals Field Number : NEP 190372-03",
- "label": "Other Numbers"
- },
- {
- "content": "499408",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "N. E. Peterson",
- "label": "Collector"
- },
- {
- "content": "Mist net in clearing in secondary rain forest at 0300 hours, n-35",
- "label": "Microhabitat Description"
- }
- ],
- "notes": [
- {
- "content": "2 Jan 2020",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "physicalDescription": [
- {
- "content": "16.8 g",
- "label": "Weight - Specimen"
- },
- {
- "content": "74 mm",
- "label": "Length - Total"
- },
- {
- "content": "9 mm",
- "label": "Length - Tail"
- },
- {
- "content": "14 mm",
- "label": "Length - Hind Tarsus"
- },
- {
- "content": "16 mm",
- "label": "Length - Ear Notch"
- },
- {
- "content": "42 mm",
- "label": "Length - Forearm"
- },
- {
- "content": "Skull",
- "label": "Preparation"
- },
- {
- "content": "Female",
- "label": "Sex"
- }
- ],
- "place": [
- {
- "content": "Zaragoza, 25 Km S, 22 Km W, At La Tirana, Antioquia, Colombia, South America",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Carollia perspicillata",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Vertebrate Zoology",
- "label": "See more items in"
- },
- {
- "content": "Mammals",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Animalia, Chordata, Vertebrata, Mammalia, Eutheria, Chiroptera, Phyllostomidae, Carolliinae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1970s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "South America",
- "type": "Continent"
- },
- "L2": {
- "content": "Colombia",
- "type": "Country"
- },
- "L3": {
- "content": "Antioquia",
- "type": "State"
- },
- "Other": {
- "content": "Zaragoza, 25 Km S, 22 Km W, At La Tirana",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Peterson, N. E."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "South America",
- "Colombia",
- "Antioquia"
- ],
- "scientific_name": [
- "Carollia perspicillata"
- ],
- "tax_class": [
- "Mammalia"
- ],
- "tax_family": [
- "Phyllostomidae"
- ],
- "tax_kingdom": [
- "Animalia"
- ],
- "tax_order": [
- "Chiroptera"
- ],
- "tax_phylum": [
- "Chordata"
- ],
- "topic": [
- "Animals",
- "Mammals"
- ]
- }
- },
- "docSignature": "3abafcf58391534918b659c20b000bc3d502b840_9bb2d51ba45bd79e0573ad627a4d21c9",
- "hash": "fffe1e6741fc6f24658bda207200d662eed382ce",
- "id": "edanmdm-nmnhvz_7377213",
- "lastTimeUpdated": "1581942281",
- "timestamp": "1581942311",
- "title": "Carollia perspicillata",
- "type": "edanmdm",
- "unitCode": "NMNHMAMMALS",
- "url": "edanmdm:nmnhvz_7377213",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Vertebrate Zoology - Mammals Division",
- "guid": "http://n2t.net/ark:/65665/39b75abdd-5ce9-44dc-9640-29866a92c480",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m331103ea829424e1e8e3ee3084bb449b1",
- "guid": "http://n2t.net/ark:/65665/m331103ea8-2942-4e1e-8e3e-e3084bb449b1",
- "idsId": "ark:/65665/m331103ea829424e1e8e3ee3084bb449b1",
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m331103ea829424e1e8e3ee3084bb449b1/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhvz_7071022",
- "record_link": "http://n2t.net/ark:/65665/39b75abdd-5ce9-44dc-9640-29866a92c480",
- "title": {
- "content": "Mephitis mephitis nigra",
- "label": "title"
- },
- "title_sort": "MEPHITIS MEPHITIS NIGRA",
- "unit_code": "NMNHMAMMALS"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Vertebrate Zoology - Mammals Division",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "8 Nov 1930",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "389361",
- "label": "Accession Number"
- },
- {
- "content": "Mammals Field Number : No Number",
- "label": "Other Numbers"
- },
- {
- "content": "566429",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "E. B. Marshall",
- "label": "Collector"
- }
- ],
- "notes": [
- {
- "content": "Item was destructively sampled for isotopic analysis. Tissue and/or parts (between 4 and 14 guard hairs sampled dorsally at the pelvic region) were sent to Elmer J. Finck, Fort Hays State University, on 25 May 2012. For reference, see Transaction No. 2060485",
- "label": "Notes"
- },
- {
- "content": "5 Nov 2019",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "physicalDescription": [
- {
- "content": "Skin",
- "label": "Preparation"
- },
- {
- "content": "Skull",
- "label": "Preparation"
- },
- {
- "content": "Male",
- "label": "Sex"
- }
- ],
- "place": [
- {
- "content": "Laurel, Prince Georges County, Maryland, United States, North America",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Mephitis mephitis nigra",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Vertebrate Zoology",
- "label": "See more items in"
- },
- {
- "content": "Mammals",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Animalia, Chordata, Vertebrata, Mammalia, Eutheria, Carnivora, Caniformia, Mephitidae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1930s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "North America",
- "type": "Continent"
- },
- "L2": {
- "content": "United States",
- "type": "Country"
- },
- "L3": {
- "content": "Maryland",
- "type": "State"
- },
- "L4": {
- "content": "Prince Georges County",
- "type": "County"
- },
- "Other": {
- "content": "Laurel",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Marshall, E. B."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Prince Georges County",
- "United States",
- "North America",
- "Maryland"
- ],
- "scientific_name": [
- "Mephitis mephitis nigra"
- ],
- "tax_class": [
- "Mammalia"
- ],
- "tax_family": [
- "Mephitidae"
- ],
- "tax_kingdom": [
- "Animalia"
- ],
- "tax_order": [
- "Carnivora"
- ],
- "tax_phylum": [
- "Chordata"
- ],
- "topic": [
- "Animals",
- "Mammals"
- ]
- }
- },
- "docSignature": "f3af07f0050193db63ff82bc900c3dd953464adc_83404e788538d74f03a10def4f528a15",
- "hash": "fff0ec347105ee933b1bbed06319a0a6ac590bb5",
- "id": "edanmdm-nmnhvz_7071022",
- "lastTimeUpdated": "1581942366",
- "timestamp": "1581942414",
- "title": "Mephitis mephitis nigra",
- "type": "edanmdm",
- "unitCode": "NMNHMAMMALS",
- "url": "edanmdm:nmnhvz_7071022",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Vertebrate Zoology - Mammals Division",
- "guid": "http://n2t.net/ark:/65665/3a961c043-0982-4d86-b601-3d640e5e0ce4",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3ac99c79239e74b6990c567f1dac11cec",
- "guid": "http://n2t.net/ark:/65665/m3ac99c792-39e7-4b69-90c5-67f1dac11cec",
- "idsId": "ark:/65665/m3ac99c79239e74b6990c567f1dac11cec",
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3ac99c79239e74b6990c567f1dac11cec/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhvz_7065900",
- "record_link": "http://n2t.net/ark:/65665/3a961c043-0982-4d86-b601-3d640e5e0ce4",
- "title": {
- "content": "Thomomys talpoides douglasii",
- "label": "title"
- },
- "title_sort": "THOMOMYS TALPOIDES DOUGLASII",
- "unit_code": "NMNHMAMMALS"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Vertebrate Zoology - Mammals Division",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "29 Mar 1953",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "000000",
- "label": "Accession Number"
- },
- {
- "content": "Mammals Field Number : 727",
- "label": "Other Numbers"
- },
- {
- "content": "566389",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "K. M. Walker",
- "label": "Collector"
- },
- {
- "content": "Ecological remarks by collector(s): yes",
- "label": "Microhabitat Description"
- }
- ],
- "notes": [
- {
- "content": "5 Nov 2019",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "physicalDescription": [
- {
- "content": "Skin",
- "label": "Preparation"
- },
- {
- "content": "Skull",
- "label": "Preparation"
- },
- {
- "content": "Female",
- "label": "Sex"
- }
- ],
- "place": [
- {
- "content": "Vancouver, 9 Mi NE, T 3 N, R 2 E, Sec 35, Clark County, Washington, United States, North America",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Thomomys talpoides douglasii",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Vertebrate Zoology",
- "label": "See more items in"
- },
- {
- "content": "Mammals",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Animalia, Chordata, Vertebrata, Mammalia, Eutheria, Rodentia, Castorimorpha, Geomyidae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1950s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "North America",
- "type": "Continent"
- },
- "L2": {
- "content": "United States",
- "type": "Country"
- },
- "L3": {
- "content": "Washington",
- "type": "State"
- },
- "L4": {
- "content": "Clark County",
- "type": "County"
- },
- "Other": {
- "content": "Vancouver, 9 Mi NE, T 3 N, R 2 E, Sec 35",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Walker, K. M."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "United States",
- "Clark County",
- "North America",
- "Washington"
- ],
- "scientific_name": [
- "Thomomys talpoides douglasii"
- ],
- "tax_class": [
- "Mammalia"
- ],
- "tax_family": [
- "Geomyidae"
- ],
- "tax_kingdom": [
- "Animalia"
- ],
- "tax_order": [
- "Rodentia"
- ],
- "tax_phylum": [
- "Chordata"
- ],
- "topic": [
- "Animals",
- "Mammals"
- ]
- }
- },
- "docSignature": "db1ab7bfff78ce9e46c217a8f058359477f85b1a_a62cbd80fb0ee904124d0b9ab725ba6a",
- "hash": "fff5ac7b57570438fe29cf96b99d99e41deb8ec4",
- "id": "edanmdm-nmnhvz_7065900",
- "lastTimeUpdated": "1581942386",
- "timestamp": "1581942414",
- "title": "Thomomys talpoides douglasii",
- "type": "edanmdm",
- "unitCode": "NMNHMAMMALS",
- "url": "edanmdm:nmnhvz_7065900",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Vertebrate Zoology - Mammals Division",
- "guid": "http://n2t.net/ark:/65665/31ff5c7f6-ce97-4bb4-a207-5255d4b70f0f",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3e20b8c4c1e4346d3b127d1ebb84b5379",
- "guid": "http://n2t.net/ark:/65665/m3e20b8c4c-1e43-46d3-b127-d1ebb84b5379",
- "idsId": "ark:/65665/m3e20b8c4c1e4346d3b127d1ebb84b5379",
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3e20b8c4c1e4346d3b127d1ebb84b5379/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhvz_7386479",
- "record_link": "http://n2t.net/ark:/65665/31ff5c7f6-ce97-4bb4-a207-5255d4b70f0f",
- "title": {
- "content": "Sorex cinereus cinereus",
- "label": "title"
- },
- "title_sort": "SOREX CINEREUS CINEREUS",
- "unit_code": "NMNHMAMMALS"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Vertebrate Zoology - Mammals Division",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "22 Aug 1960",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "315605",
- "label": "Accession Number"
- },
- {
- "content": "Mammals Field Number : RWT 660",
- "label": "Other Numbers"
- },
- {
- "content": "515006",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "R. W. Thorington Jr.",
- "label": "Collector"
- },
- {
- "content": "Marsh",
- "label": "Microhabitat Description"
- }
- ],
- "notes": [
- {
- "content": "10 Dec 2019",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "physicalDescription": [
- {
- "content": "2.9 g",
- "label": "Weight - Specimen"
- },
- {
- "content": "90 mm",
- "label": "Length - Total"
- },
- {
- "content": "40 mm",
- "label": "Length - Tail"
- },
- {
- "content": "12 mm",
- "label": "Length - Hind Tarsus"
- },
- {
- "content": "Skull",
- "label": "Preparation"
- },
- {
- "content": "Skeleton",
- "label": "Preparation"
- },
- {
- "content": "Male",
- "label": "Sex"
- }
- ],
- "place": [
- {
- "content": "Gothic, 3 Mi N, Gunnison County, Colorado, United States, North America",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Sorex cinereus cinereus",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Vertebrate Zoology",
- "label": "See more items in"
- },
- {
- "content": "Mammals",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Animalia, Chordata, Vertebrata, Mammalia, Eutheria, Soricomorpha, Soricidae, Soricinae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1960s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "North America",
- "type": "Continent"
- },
- "L2": {
- "content": "United States",
- "type": "Country"
- },
- "L3": {
- "content": "Colorado",
- "type": "State"
- },
- "L4": {
- "content": "Gunnison County",
- "type": "County"
- },
- "Other": {
- "content": "Gothic, 3 Mi N",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Thorington, R. W."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Gunnison County",
- "United States",
- "Colorado",
- "North America"
- ],
- "scientific_name": [
- "Sorex cinereus cinereus"
- ],
- "tax_class": [
- "Mammalia"
- ],
- "tax_family": [
- "Soricidae"
- ],
- "tax_kingdom": [
- "Animalia"
- ],
- "tax_order": [
- "Soricomorpha"
- ],
- "tax_phylum": [
- "Chordata"
- ],
- "topic": [
- "Animals",
- "Mammals"
- ]
- }
- },
- "docSignature": "4b89e540442f7e31f6a18a328895b5fac9dd47f7_0320a883aaaad5d31365a7e72d2b7e5e",
- "hash": "fff817f866d7ccd052ca43f742efa36b779d578b",
- "id": "edanmdm-nmnhvz_7386479",
- "lastTimeUpdated": "1581942396",
- "timestamp": "1581942414",
- "title": "Sorex cinereus cinereus",
- "type": "edanmdm",
- "unitCode": "NMNHMAMMALS",
- "url": "edanmdm:nmnhvz_7386479",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Mineral Sciences Dept.",
- "guid": "http://n2t.net/ark:/65665/3d0aee12b-0434-4ad2-8d36-7da89689798a",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3d171922cb2a8417ba9b906aa25fc22ed",
- "guid": "http://n2t.net/ark:/65665/m3d171922c-b2a8-417b-a9b9-06aa25fc22ed",
- "idsId": "ark:/65665/m3d171922cb2a8417ba9b906aa25fc22ed",
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3d171922cb2a8417ba9b906aa25fc22ed/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- },
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3425eb4df93524839b7216e04cd16f629",
- "guid": "http://n2t.net/ark:/65665/m3425eb4df-9352-4839-b721-6e04cd16f629",
- "idsId": "ark:/65665/m3425eb4df93524839b7216e04cd16f629",
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3425eb4df93524839b7216e04cd16f629/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 2
- },
- "record_ID": "nmnhmineralsciences_1038632",
- "record_link": "http://n2t.net/ark:/65665/3d0aee12b-0434-4ad2-8d36-7da89689798a",
- "title": {
- "content": "QUE 94323,2",
- "label": "title"
- },
- "title_sort": "QUE 943232",
- "unit_code": "NMNHMINSCI"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Mineral Sciences Dept.",
- "label": "Data Source"
- }
- ],
- "notes": [
- {
- "content": "23 Aug 2018",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Antarctica",
- "label": "Place"
- }
- ],
- "setName": [
- {
- "content": "Mineral Sciences",
- "label": "See more items in"
- },
- {
- "content": "Meteorites",
- "label": "See more items in"
- },
- {
- "content": "Antarctic Polished Thin Section Collection",
- "label": "See more items in"
- },
- {
- "content": "Digital Collection: Micrographs",
- "label": "See more items in"
- }
- ]
- },
- "indexedStructured": {
- "geoLocation": [
- {
- "L1": {
- "content": "Antarctica",
- "type": "Continent"
- },
- "L2": {
- "content": "Antarctica",
- "type": "Country"
- }
- }
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Antarctica"
- ],
- "topic": [
- "Meteorites"
- ]
- }
- },
- "docSignature": "e45468ede6d9bf9e38e4d52b783e8c66f50b2cf1_dc7154f91bd07ae264119101352ce9ea",
- "hash": "fffcfb582b93f7750c2e49648e137476d066fe8b",
- "id": "edanmdm-nmnhmineralsciences_1038632",
- "lastTimeUpdated": "1581939498",
- "timestamp": "1581939540",
- "title": "QUE 94323,2",
- "type": "edanmdm",
- "unitCode": "NMNHMINSCI",
- "url": "edanmdm:nmnhmineralsciences_1038632",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Paleobiology Dept.",
- "guid": "http://n2t.net/ark:/65665/3e8448b77-4708-4e5c-a241-42b84955d028",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3dc9bd663358d4053992c2be54b227c6b",
- "guid": "http://n2t.net/ark:/65665/m3dc9bd663-358d-4053-992c-2be54b227c6b",
- "idsId": "ark:/65665/m3dc9bd663358d4053992c2be54b227c6b",
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3dc9bd663358d4053992c2be54b227c6b/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhpaleobiology_3153147",
- "record_link": "http://n2t.net/ark:/65665/3e8448b77-4708-4e5c-a241-42b84955d028",
- "title": {
- "content": "Ramulina angusta Loeblich & Tappan Loeblich, 1994",
- "label": "title"
- },
- "title_sort": "RAMULINA ANGUSTA LOEBLICH TAPPAN LOEBLICH 1994",
- "unit_code": "NMNHPALEO"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Paleobiology Dept.",
- "label": "Data Source"
- }
- ],
- "identifier": [
- {
- "content": "PAL470480",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "Indian Ocean, Timor Sea",
- "label": "Ocean/Sea/Gulf"
- }
- ],
- "notes": [
- {
- "content": "Cenozoic - Recent",
- "label": "Geologic Age"
- },
- {
- "content": "4 Dec 2015",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "objectType": [
- {
- "content": "Loeblich & Tappan Loeblich, H. N. 1994. Cushman Found.Foram.Research Spec.Pub. (n.31): 84, pl.149,f.16.",
- "label": "Type Citation"
- },
- {
- "content": "holotype",
- "label": "Type Status"
- }
- ],
- "place": [
- {
- "content": "Central Timor Sea, N Of Sahul Rise, Indian Ocean",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Ramulina angusta Loeblich & Tappan Loeblich, 1994",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Paleogeneral",
- "label": "See more items in"
- },
- {
- "content": "Types: Foraminifera",
- "label": "See more items in"
- },
- {
- "content": "Foraminiferida Primary Type Microslides",
- "label": "See more items in"
- },
- {
- "content": "Paleobiology",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Protoctista Granuloreticulosa Foraminifera",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "geoLocation": [
- {
- "L1": {
- "content": "Indian Ocean",
- "type": "Continent"
- },
- "Other": {
- "content": "Central Timor Sea, N Of Sahul Rise",
- "type": "Locality"
- },
- "points": {
- "point": {
- "latitude": {
- "content": "-10.7417",
- "type": "decimal"
- },
- "longitude": {
- "content": "126.263",
- "type": "decimal"
- }
- }
- }
- }
- ],
- "geo_age-era": [
- "Cenozoic"
- ],
- "geo_age-system": [
- "Recent"
- ],
- "object_type": [
- "Holotypes",
- "Taxonomic type specimens"
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Indian Ocean"
- ],
- "scientific_name": [
- "Ramulina angusta Loeblich & Tappan Loeblich, 1994"
- ],
- "tax_class": [
- "Foraminifera"
- ],
- "tax_kingdom": [
- "Protoctista",
- "Rhizaria"
- ],
- "tax_phylum": [
- "Granuloreticulosa",
- "Foraminifera"
- ],
- "topic": [
- "Paleogeneral",
- "Protists"
- ]
- }
- },
- "docSignature": "93769df3c721aec8ff849dfffb66472a4f8d53a0_252dc9a54830ef145212be8f101b6824",
- "hash": "fff02a7ced34bee6758c98d485aa8f015f25e460",
- "id": "edanmdm-nmnhpaleobiology_3153147",
- "lastTimeUpdated": "1581940008",
- "timestamp": "1581940009",
- "title": "Ramulina angusta Loeblich & Tappan Loeblich, 1994",
- "type": "edanmdm",
- "unitCode": "NMNHPALEO",
- "url": "edanmdm:nmnhpaleobiology_3153147",
- "version": ""
- }
- ]
- },
- "responseCode": 1,
- "status": 200
-}
diff --git a/tests/dags/providers/provider_api_scripts/resources/smithsonian/actual_response2.json b/tests/dags/providers/provider_api_scripts/resources/smithsonian/actual_response2.json
deleted file mode 100644
index 78b0390bc..000000000
--- a/tests/dags/providers/provider_api_scripts/resources/smithsonian/actual_response2.json
+++ /dev/null
@@ -1,2002 +0,0 @@
-{
- "response": {
- "message": "content found",
- "rowCount": 709,
- "rows": [
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/3c50bc2a5-c670-4d3d-a71d-fa64353ac457",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3e039e45a1f3e437a87f8f2e4c2dc436a",
- "guid": "http://n2t.net/ark:/65665/m3e039e45a-1f3e-437a-87f8-f2e4c2dc436a",
- "idsId": "ark:/65665/m3e039e45a1f3e437a87f8f2e4c2dc436a",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01608899.tif"
- },
- {
- "label": "High-resolution JPEG (6945x6945)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01608899.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01608899_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01608899_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3e039e45a1f3e437a87f8f2e4c2dc436a/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12546856",
- "record_link": "http://n2t.net/ark:/65665/3c50bc2a5-c670-4d3d-a71d-fa64353ac457",
- "title": {
- "content": "Alansmia senilis (F\u00e9e) Moguel & M. Kessler",
- "label": "title"
- },
- "title_sort": "ALANSMIA SENILIS FE MOGUEL M KESSLER",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "23 Feb 1971",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01608899",
- "label": "Barcode"
- },
- {
- "content": "2723992",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "83 - Western South America",
- "label": "Biogeographical Region"
- },
- {
- "content": "David B. Lellinger",
- "label": "Collector"
- },
- {
- "content": "Elias R. de la Sota",
- "label": "Collector"
- },
- {
- "content": "100",
- "label": "Max. Elevation"
- },
- {
- "content": "75",
- "label": "Min. Elevation"
- }
- ],
- "notes": [
- {
- "content": "1 Nov 2016",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Colombia, Choc\u00f3: R\u00edo El Salto (tributary of the R\u00edo Suruci), 9 km W of Andagoya., Choc\u00f3, Colombia, South America - Neotropics",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Alansmia senilis (F\u00e9e) Moguel & M. Kessler",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Plantae Pteridophyte Polypodiales Polypodiaceae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1970s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "South America - Neotropics",
- "type": "Continent"
- },
- "L2": {
- "content": "Colombia",
- "type": "Country"
- },
- "L3": {
- "content": "Choc\u00f3",
- "type": "State"
- },
- "Other": {
- "content": "Colombia, Choc\u00f3: R\u00edo El Salto (tributary of the R\u00edo Suruci), 9 km W of Andagoya.",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Lellinger, D. B.",
- "de la Sota, E. R."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Colombia",
- "Choc\u00f3",
- "South America - Neotropics"
- ],
- "scientific_name": [
- "Alansmia senilis (F\u00e9e) Moguel & M. Kessler"
- ],
- "tax_class": [
- "Pteridophyte"
- ],
- "tax_family": [
- "Polypodiaceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Polypodiales"
- ],
- "topic": [
- "Pteridophyte"
- ]
- }
- },
- "docSignature": "75efa8f2825a6e7ba8f40350b80c8b0cbf35c222_79bfe68aacbb0bf3aeb2149a5b1317c8",
- "hash": "ccc206f1153a56be7bffd3d072b729b589b369d0",
- "id": "edanmdm-nmnhbotany_12546856",
- "lastTimeUpdated": "1581934539",
- "timestamp": "1581934606",
- "title": "Alansmia senilis (F\u00e9e) Moguel & M. Kessler",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12546856",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/336418fec-8927-48b1-ae7f-d302a3482fbe",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m32bf00aad8e734be7855c7932922917c1",
- "guid": "http://n2t.net/ark:/65665/m32bf00aad-8e73-4be7-855c-7932922917c1",
- "idsId": "ark:/65665/m32bf00aad8e734be7855c7932922917c1",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01609344.tif"
- },
- {
- "label": "High-resolution JPEG (6934x6934)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01609344.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01609344_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01609344_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m32bf00aad8e734be7855c7932922917c1/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12553969",
- "record_link": "http://n2t.net/ark:/65665/336418fec-8927-48b1-ae7f-d302a3482fbe",
- "title": {
- "content": "Ceradenia nubigena (Maxon) L.E. Bishop",
- "label": "title"
- },
- "title_sort": "CERADENIA NUBIGENA MAXON LE BISHOP",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "1956",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01609344",
- "label": "Barcode"
- },
- {
- "content": "1694712",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "83 - Western South America",
- "label": "Biogeographical Region"
- },
- {
- "content": "C. Bues",
- "label": "Collector"
- },
- {
- "content": "2804",
- "label": "Min. Elevation"
- }
- ],
- "notes": [
- {
- "content": "1 Nov 2016",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Peru, Abra Huallayo, hda. Puertobar [illegible text]. [interpreted], Peru, South America - Neotropics",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Ceradenia nubigena (Maxon) L.E. Bishop",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Plantae Pteridophyte Polypodiales Polypodiaceae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1950s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "South America - Neotropics",
- "type": "Continent"
- },
- "L2": {
- "content": "Peru",
- "type": "Country"
- },
- "Other": {
- "content": "Peru, Abra Huallayo, hda. Puertobar [illegible text]. [interpreted]",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Bues, C."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "South America - Neotropics",
- "Peru"
- ],
- "scientific_name": [
- "Ceradenia nubigena (Maxon) L.E. Bishop"
- ],
- "tax_class": [
- "Pteridophyte"
- ],
- "tax_family": [
- "Polypodiaceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Polypodiales"
- ],
- "topic": [
- "Pteridophyte"
- ]
- }
- },
- "docSignature": "ea1f2b116ccff989afd85a352a26358504ae16df_0d690ee0676c9a091a11ab6b32b88c8e",
- "hash": "ccc2808fb5ed57b32b51c95b75afef6e650647fe",
- "id": "edanmdm-nmnhbotany_12553969",
- "lastTimeUpdated": "1581934539",
- "timestamp": "1581934606",
- "title": "Ceradenia nubigena (Maxon) L.E. Bishop",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12553969",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/328d7fb88-5419-43a3-b18f-f118c2fdc4cf",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3139e244b9d33452d924431c6bdef6199",
- "guid": "http://n2t.net/ark:/65665/m3139e244b-9d33-452d-9244-31c6bdef6199",
- "idsId": "ark:/65665/m3139e244b9d33452d924431c6bdef6199",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01614719.tif"
- },
- {
- "label": "High-resolution JPEG (6968x6968)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01614719.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01614719_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01614719_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3139e244b9d33452d924431c6bdef6199/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12561528",
- "record_link": "http://n2t.net/ark:/65665/328d7fb88-5419-43a3-b18f-f118c2fdc4cf",
- "title": {
- "content": "Achyrachaena mollis Schauer",
- "label": "title"
- },
- "title_sort": "ACHYRACHAENA MOLLIS SCHAUER",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "20 May 1955",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01614719",
- "label": "Barcode"
- },
- {
- "content": "2998537",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "76 - Southwestern U.S.A.",
- "label": "Biogeographical Region"
- },
- {
- "content": "J. H. Thomas",
- "label": "Collector"
- },
- {
- "content": "6",
- "label": "Min. Elevation"
- }
- ],
- "notes": [
- {
- "content": "4 Aug 2017",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Western North America, Solano County, roadside along Highway #21, 3.5 miles S of Cordelia, California, United States, North America",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Achyrachaena mollis Schauer",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Plantae Dicotyledonae Asterales Asteraceae Asteroideae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1950s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "North America",
- "type": "Continent"
- },
- "L2": {
- "content": "United States",
- "type": "Country"
- },
- "L3": {
- "content": "California",
- "type": "State"
- },
- "Other": {
- "content": "Western North America, Solano County, roadside along Highway #21, 3.5 miles S of Cordelia",
- "type": "Locality"
- },
- "points": {
- "point": {
- "latitude": {
- "content": "38.1617",
- "type": "decimal"
- },
- "longitude": {
- "content": "-122.12",
- "type": "decimal"
- }
- }
- }
- }
- ],
- "name": [
- "Thomas, J. H."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "United States",
- "California",
- "North America"
- ],
- "scientific_name": [
- "Achyrachaena mollis Schauer"
- ],
- "tax_class": [
- "Dicotyledonae"
- ],
- "tax_family": [
- "Asteraceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Asterales"
- ],
- "topic": [
- "Dicotyledonae"
- ]
- }
- },
- "docSignature": "0b5c79f3f5496b85786b090a039644d619db1efc_d13967ffb6016ec140a106e1d5d4b447",
- "hash": "ccc9e48941742278fe3da081bfe0c7af04d45cec",
- "id": "edanmdm-nmnhbotany_12561528",
- "lastTimeUpdated": "1581934542",
- "timestamp": "1581934606",
- "title": "Achyrachaena mollis Schauer",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12561528",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/3a7776aa2-acaa-48b2-8565-9240f0cdba30",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3883e12eaa5f540d6aef9fb1028e13d3a",
- "guid": "http://n2t.net/ark:/65665/m3883e12ea-a5f5-40d6-aef9-fb1028e13d3a",
- "idsId": "ark:/65665/m3883e12eaa5f540d6aef9fb1028e13d3a",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01615582.tif"
- },
- {
- "label": "High-resolution JPEG (6915x6915)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01615582.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01615582_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01615582_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3883e12eaa5f540d6aef9fb1028e13d3a/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12562235",
- "record_link": "http://n2t.net/ark:/65665/3a7776aa2-acaa-48b2-8565-9240f0cdba30",
- "title": {
- "content": "Barnadesia aculeata (Benth.) I.C. Chung",
- "label": "title"
- },
- "title_sort": "BARNADESIA ACULEATA BENTH IC CHUNG",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "3 May 1997",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01615582",
- "label": "Barcode"
- },
- {
- "content": "3381947",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "83 - Western South America",
- "label": "Biogeographical Region"
- },
- {
- "content": "Homero Vargas",
- "label": "Collector"
- },
- {
- "content": "Chris Canaday",
- "label": "Collector"
- },
- {
- "content": "3595",
- "label": "Min. Elevation"
- }
- ],
- "notes": [
- {
- "content": "4 Aug 2017",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Chilla Canton, Cerro de Chilla. Vegetacion de paramo, arbustivay herbacea, El Oro, Ecuador, South America - Neotropics",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Barnadesia aculeata (Benth.) I.C. Chung",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Plantae Dicotyledonae Asterales Asteraceae Barnadesioideae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1990s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "South America - Neotropics",
- "type": "Continent"
- },
- "L2": {
- "content": "Ecuador",
- "type": "Country"
- },
- "L3": {
- "content": "El Oro",
- "type": "State"
- },
- "Other": {
- "content": "Chilla Canton, Cerro de Chilla. Vegetacion de paramo, arbustivay herbacea",
- "type": "Locality"
- },
- "points": {
- "point": {
- "latitude": {
- "content": "-3.5",
- "type": "decimal"
- },
- "longitude": {
- "content": "-79.63",
- "type": "decimal"
- }
- }
- }
- }
- ],
- "name": [
- "Canaday, C.",
- "Vargas, H."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Ecuador",
- "El Oro",
- "South America - Neotropics"
- ],
- "scientific_name": [
- "Barnadesia aculeata (Benth.) I.C. Chung"
- ],
- "tax_class": [
- "Dicotyledonae"
- ],
- "tax_family": [
- "Asteraceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Asterales"
- ],
- "topic": [
- "Dicotyledonae"
- ]
- }
- },
- "docSignature": "a57e9baf8b5e53981a05a42e946ddfbaaf19b8eb_00d53cdbeaa465049fd8e2d3e9109f5a",
- "hash": "cccaa46b30716a417d4e81ac7497e3c73a9549c7",
- "id": "edanmdm-nmnhbotany_12562235",
- "lastTimeUpdated": "1581934542",
- "timestamp": "1581934606",
- "title": "Barnadesia aculeata (Benth.) I.C. Chung",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12562235",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/3436e447b-7d43-4898-9d34-c5e496759e7f",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3cbe317f095744956afeb3402f6a3f31f",
- "guid": "http://n2t.net/ark:/65665/m3cbe317f0-9574-4956-afeb-3402f6a3f31f",
- "idsId": "ark:/65665/m3cbe317f095744956afeb3402f6a3f31f",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01670328.tif"
- },
- {
- "label": "High-resolution JPEG (6923x6923)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01670328.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01670328_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01670328_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3cbe317f095744956afeb3402f6a3f31f/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12680228",
- "record_link": "http://n2t.net/ark:/65665/3436e447b-7d43-4898-9d34-c5e496759e7f",
- "title": {
- "content": "Mikania cordifolia H.B.K.",
- "label": "title"
- },
- "title_sort": "MIKANIA CORDIFOLIA HBK",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "3 Aug 1961",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01670328",
- "label": "Barcode"
- },
- {
- "content": "2398138",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "79 - Mexico Central",
- "label": "Biogeographical Region"
- },
- {
- "content": "Claude E. Smith Jr.",
- "label": "Collector"
- },
- {
- "content": "F. A. Peterson",
- "label": "Collector"
- },
- {
- "content": "Narcisso Tejeda",
- "label": "Collector"
- },
- {
- "content": "3250",
- "label": "Max. Elevation"
- },
- {
- "content": "2000",
- "label": "Min. Elevation"
- }
- ],
- "notes": [
- {
- "content": "4 Aug 2017",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Tehuacan area, above Teotitlan del Camino on the road to Huautla, Puebla, Mexico, North America - Neotropics",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Mikania cordifolia H.B.K.",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Plantae Dicotyledonae Asterales Asteraceae Asteroideae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1960s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "North America - Neotropics",
- "type": "Continent"
- },
- "L2": {
- "content": "Mexico",
- "type": "Country"
- },
- "L3": {
- "content": "Puebla",
- "type": "State"
- },
- "Other": {
- "content": "Tehuacan area, above Teotitlan del Camino on the road to Huautla",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Smith, C. E.",
- "Tejeda, N.",
- "Peterson, F. A."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "North America - Neotropics",
- "Puebla",
- "Mexico"
- ],
- "scientific_name": [
- "Mikania cordifolia H.B.K."
- ],
- "tax_class": [
- "Dicotyledonae"
- ],
- "tax_family": [
- "Asteraceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Asterales"
- ],
- "topic": [
- "Dicotyledonae"
- ]
- }
- },
- "docSignature": "0c231a289b1d6f564e63b1b24302e07e40c95615_d96b8aabdfa5a44bab18a56852e33116",
- "hash": "ccc041365dfe49c12f26a2b8cbb651f773a2e564",
- "id": "edanmdm-nmnhbotany_12680228",
- "lastTimeUpdated": "1581934623",
- "timestamp": "1581934683",
- "title": "Mikania cordifolia H.B.K.",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12680228",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/39f2a037f-e1aa-49fe-bc78-37800525ffbe",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3ce8c5d3cfb5d4a9d9779a9965580c9f7",
- "guid": "http://n2t.net/ark:/65665/m3ce8c5d3c-fb5d-4a9d-9779-a9965580c9f7",
- "idsId": "ark:/65665/m3ce8c5d3cfb5d4a9d9779a9965580c9f7",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01670916.tif"
- },
- {
- "label": "High-resolution JPEG (6981x6981)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01670916.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01670916_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01670916_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3ce8c5d3cfb5d4a9d9779a9965580c9f7/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12681014",
- "record_link": "http://n2t.net/ark:/65665/39f2a037f-e1aa-49fe-bc78-37800525ffbe",
- "title": {
- "content": "Mikania oreimeles B.L. Rob.",
- "label": "title"
- },
- "title_sort": "MIKANIA OREIMELES BL ROB",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "5 Feb 1978",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01670916",
- "label": "Barcode"
- },
- {
- "content": "2827701",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "83 - Western South America",
- "label": "Biogeographical Region"
- },
- {
- "content": "Robert M. King",
- "label": "Collector"
- },
- {
- "content": "Luther Earl Bishop",
- "label": "Collector"
- },
- {
- "content": "2591",
- "label": "Min. Elevation"
- }
- ],
- "notes": [
- {
- "content": "4 Aug 2017",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "26 kms from Comarapa,on road to Cochabamba, Cochabamba, Bolivia, South America - Neotropics",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Mikania oreimeles B.L. Rob.",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Plantae Dicotyledonae Asterales Asteraceae Asteroideae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1970s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "South America - Neotropics",
- "type": "Continent"
- },
- "L2": {
- "content": "Bolivia",
- "type": "Country"
- },
- "L3": {
- "content": "Cochabamba",
- "type": "State"
- },
- "Other": {
- "content": "26 kms from Comarapa,on road to Cochabamba",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "King, R. M.",
- "Bishop, L. E."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Cochabamba",
- "Bolivia",
- "South America - Neotropics"
- ],
- "scientific_name": [
- "Mikania oreimeles B.L. Rob."
- ],
- "tax_class": [
- "Dicotyledonae"
- ],
- "tax_family": [
- "Asteraceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Asterales"
- ],
- "topic": [
- "Dicotyledonae"
- ]
- }
- },
- "docSignature": "ebd287ecf1b56981b2175724ffd6b27dad845414_c33c626a96aa6d72566fa10b42471955",
- "hash": "cccdc609a950d580a44bb0b56451e23250e7ea78",
- "id": "edanmdm-nmnhbotany_12681014",
- "lastTimeUpdated": "1581934624",
- "timestamp": "1581934683",
- "title": "Mikania oreimeles B.L. Rob.",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12681014",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/39bc2acf3-dd56-4691-b865-a10ca037f5db",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m345676a78bcc4485f9dc9e540a0e77ddd",
- "guid": "http://n2t.net/ark:/65665/m345676a78-bcc4-485f-9dc9-e540a0e77ddd",
- "idsId": "ark:/65665/m345676a78bcc4485f9dc9e540a0e77ddd",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01676127.tif"
- },
- {
- "label": "High-resolution JPEG (6932x6932)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01676127.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01676127_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01676127_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m345676a78bcc4485f9dc9e540a0e77ddd/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12686802",
- "record_link": "http://n2t.net/ark:/65665/39bc2acf3-dd56-4691-b865-a10ca037f5db",
- "title": {
- "content": "Ageratina ligustrina (DC.) R.M. King & H. Rob.",
- "label": "title"
- },
- "title_sort": "AGERATINA LIGUSTRINA DC RM KING H ROB",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "Dec 1902",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01676127",
- "label": "Barcode"
- },
- {
- "content": "1401166",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "80 - Central America",
- "label": "Biogeographical Region"
- },
- {
- "content": "Hans von T\u00fcrckheim",
- "label": "Collector"
- },
- {
- "content": "1300",
- "label": "Min. Elevation"
- }
- ],
- "notes": [
- {
- "content": "4 Aug 2017",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Cob\u00e1n, Alta Verapaz, Guatemala, Central America - Neotropics",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Ageratina ligustrina (DC.) R.M. King & H. Rob.",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Plantae Dicotyledonae Asterales Asteraceae Asteroideae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1900s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "Central America - Neotropics",
- "type": "Continent"
- },
- "L2": {
- "content": "Guatemala",
- "type": "Country"
- },
- "L3": {
- "content": "Alta Verapaz",
- "type": "State"
- },
- "Other": {
- "content": "Cob\u00e1n",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "T\u00fcrckheim, H. von"
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Alta Verapaz",
- "Guatemala",
- "Central America - Neotropics"
- ],
- "scientific_name": [
- "Ageratina ligustrina (DC.) R.M. King & H. Rob."
- ],
- "tax_class": [
- "Dicotyledonae"
- ],
- "tax_family": [
- "Asteraceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Asterales"
- ],
- "topic": [
- "Dicotyledonae"
- ]
- }
- },
- "docSignature": "77be8c055d767f71f50dec17bccff3847aff3d9b_f6c64d07b070b8fe89b5b7434e22d0d7",
- "hash": "ccc91159b3375206c7ad2a7a6d24ff186ae5e1be",
- "id": "edanmdm-nmnhbotany_12686802",
- "lastTimeUpdated": "1581934626",
- "timestamp": "1581934683",
- "title": "Ageratina ligustrina (DC.) R.M. King & H. Rob.",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12686802",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/3dad00028-0f88-401d-b201-14b1fd226616",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m31a1de7d2f7304bb585b4833a4f18c9cd",
- "guid": "http://n2t.net/ark:/65665/m31a1de7d2-f730-4bb5-85b4-833a4f18c9cd",
- "idsId": "ark:/65665/m31a1de7d2f7304bb585b4833a4f18c9cd",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01677665.tif"
- },
- {
- "label": "High-resolution JPEG (6904x6904)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01677665.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01677665_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01677665_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m31a1de7d2f7304bb585b4833a4f18c9cd/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12711748",
- "record_link": "http://n2t.net/ark:/65665/3dad00028-0f88-401d-b201-14b1fd226616",
- "title": {
- "content": "Ageratina tinifolia (Kunth) R.M. King & H. Rob.",
- "label": "title"
- },
- "title_sort": "AGERATINA TINIFOLIA KUNTH RM KING H ROB",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "30 Sep 1981",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01677665",
- "label": "Barcode"
- },
- {
- "content": "3256300",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "83 - Western South America",
- "label": "Biogeographical Region"
- },
- {
- "content": "Pilar Franco Roselli",
- "label": "Collector"
- },
- {
- "content": "O. Rangel",
- "label": "Collector"
- },
- {
- "content": "2850",
- "label": "Min. Elevation"
- }
- ],
- "notes": [
- {
- "content": "4 Aug 2017",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Municipio de Fomeque; Parque Nacional Natural de Chingaza, Alrededores de la Laguna de Chingaza, Cundinamarca, Colombia, South America - Neotropics",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Ageratina tinifolia (Kunth) R.M. King & H. Rob.",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Manguillo",
- "label": "Common name"
- },
- {
- "content": "Plantae Dicotyledonae Asterales Asteraceae Asteroideae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "common_name": [
- "Manguillo"
- ],
- "date": [
- "1980s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "South America - Neotropics",
- "type": "Continent"
- },
- "L2": {
- "content": "Colombia",
- "type": "Country"
- },
- "L3": {
- "content": "Cundinamarca",
- "type": "State"
- },
- "Other": {
- "content": "Municipio de Fomeque; Parque Nacional Natural de Chingaza, Alrededores de la Laguna de Chingaza",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Franco Roselli, P.",
- "Rangel, O."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Colombia",
- "Cundinamarca",
- "South America - Neotropics"
- ],
- "scientific_name": [
- "Ageratina tinifolia (Kunth) R.M. King & H. Rob."
- ],
- "tax_class": [
- "Dicotyledonae"
- ],
- "tax_family": [
- "Asteraceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Asterales"
- ],
- "topic": [
- "Dicotyledonae"
- ]
- }
- },
- "docSignature": "ff6dec270095cbaa6c411e539aa33dc001534fcc_292f57f771c4b41a2d055d20fe44f276",
- "hash": "ccc5c07e219b6777bf113e9e5ea5a392d7099283",
- "id": "edanmdm-nmnhbotany_12711748",
- "lastTimeUpdated": "1581934627",
- "timestamp": "1581934683",
- "title": "Ageratina tinifolia (Kunth) R.M. King & H. Rob.",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12711748",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/39dd8f785-645d-4759-a4ab-64fdf7c8819c",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m374f75c1c5c6849faa6d17be41b086eca",
- "guid": "http://n2t.net/ark:/65665/m374f75c1c-5c68-49fa-a6d1-7be41b086eca",
- "idsId": "ark:/65665/m374f75c1c5c6849faa6d17be41b086eca",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01677996.tif"
- },
- {
- "label": "High-resolution JPEG (6958x6958)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01677996.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01677996_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01677996_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m374f75c1c5c6849faa6d17be41b086eca/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12686506",
- "record_link": "http://n2t.net/ark:/65665/39dd8f785-645d-4759-a4ab-64fdf7c8819c",
- "title": {
- "content": "Ageratina pichinchensis (Kunth) R.M. King & H. Rob.",
- "label": "title"
- },
- "title_sort": "AGERATINA PICHINCHENSIS KUNTH RM KING H ROB",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "24 Jan 1976",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01677996",
- "label": "Barcode"
- },
- {
- "content": "2727486",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "83 - Western South America",
- "label": "Biogeographical Region"
- },
- {
- "content": "Robert M. King",
- "label": "Collector"
- },
- {
- "content": "Robert M. Garvey",
- "label": "Collector"
- },
- {
- "content": "2713",
- "label": "Min. Elevation"
- }
- ],
- "notes": [
- {
- "content": "4 Aug 2017",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Azuay: along the road to Loja, 12 kms SE of Cumbe, Azuay, Ecuador, South America - Neotropics",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Ageratina pichinchensis (Kunth) R.M. King & H. Rob.",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "Plantae Dicotyledonae Asterales Asteraceae Asteroideae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "date": [
- "1970s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "South America - Neotropics",
- "type": "Continent"
- },
- "L2": {
- "content": "Ecuador",
- "type": "Country"
- },
- "L3": {
- "content": "Azuay",
- "type": "State"
- },
- "Other": {
- "content": "Azuay: along the road to Loja, 12 kms SE of Cumbe",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Garvey, R. M.",
- "King, R. M."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "Ecuador",
- "Azuay",
- "South America - Neotropics"
- ],
- "scientific_name": [
- "Ageratina pichinchensis (Kunth) R.M. King & H. Rob."
- ],
- "tax_class": [
- "Dicotyledonae"
- ],
- "tax_family": [
- "Asteraceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Asterales"
- ],
- "topic": [
- "Dicotyledonae"
- ]
- }
- },
- "docSignature": "be0238b750e0ac6ae8695dca9f7c2860b7b5085f_cdaba8f515121c32fe9cf1f9e92b2d27",
- "hash": "cccb917f67421b2b43210e983421f053d22a65d7",
- "id": "edanmdm-nmnhbotany_12686506",
- "lastTimeUpdated": "1581934627",
- "timestamp": "1581934683",
- "title": "Ageratina pichinchensis (Kunth) R.M. King & H. Rob.",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12686506",
- "version": ""
- },
- {
- "content": {
- "descriptiveNonRepeating": {
- "data_source": "NMNH - Botany Dept.",
- "guid": "http://n2t.net/ark:/65665/31ea20328-7780-4e6a-b981-42d3923dbd72",
- "metadata_usage": {
- "access": "CC0"
- },
- "online_media": {
- "media": [
- {
- "content": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3c7ded58a70174b5497b821b19bd16268",
- "guid": "http://n2t.net/ark:/65665/m3c7ded58a-7017-4b54-97b8-21b19bd16268",
- "idsId": "ark:/65665/m3c7ded58a70174b5497b821b19bd16268",
- "resources": [
- {
- "label": "High-resolution TIFF",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01680775.tif"
- },
- {
- "label": "High-resolution JPEG (6878x6878)",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01680775.jpg"
- },
- {
- "label": "Screen Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01680775_screen"
- },
- {
- "label": "Thumbnail Image",
- "url": "https://ids.si.edu/ids/download?id=NMNH-01680775_thumb"
- }
- ],
- "thumbnail": "https://ids.si.edu/ids/deliveryService/id/ark:/65665/m3c7ded58a70174b5497b821b19bd16268/90",
- "type": "Images",
- "usage": {
- "access": "CC0"
- }
- }
- ],
- "mediaCount": 1
- },
- "record_ID": "nmnhbotany_12690244",
- "record_link": "http://n2t.net/ark:/65665/31ea20328-7780-4e6a-b981-42d3923dbd72",
- "title": {
- "content": "Gutierrezia californica Torr. & A. Gray",
- "label": "title"
- },
- "title_sort": "GUTIERREZIA CALIFORNICA TORR A GRAY",
- "unit_code": "NMNHBOTANY"
- },
- "freetext": {
- "dataSource": [
- {
- "content": "NMNH - Botany Dept.",
- "label": "Data Source"
- }
- ],
- "date": [
- {
- "content": "Aug 1888",
- "label": "Collection Date"
- }
- ],
- "identifier": [
- {
- "content": "01680775",
- "label": "Barcode"
- },
- {
- "content": "69860",
- "label": "USNM Number"
- }
- ],
- "name": [
- {
- "content": "76 - Southwestern U.S.A.",
- "label": "Biogeographical Region"
- },
- {
- "content": "Edward L. Greene",
- "label": "Collector"
- }
- ],
- "notes": [
- {
- "content": "4 Aug 2017",
- "label": "Record Last Modified"
- },
- {
- "content": "1",
- "label": "Specimen Count"
- }
- ],
- "place": [
- {
- "content": "Oakland Hills, California, United States, North America",
- "label": "Place"
- }
- ],
- "publisher": [
- {
- "content": "Gutierrezia californica Torr. & A. Gray",
- "label": "Published Name"
- }
- ],
- "setName": [
- {
- "content": "Botany",
- "label": "See more items in"
- },
- {
- "content": "Flowering plants and ferns",
- "label": "See more items in"
- }
- ],
- "taxonomicName": [
- {
- "content": "San Joaquin snakeweed",
- "label": "Common name"
- },
- {
- "content": "Plantae Dicotyledonae Asterales Asteraceae Asteroideae",
- "label": "Taxonomy"
- }
- ]
- },
- "indexedStructured": {
- "common_name": [
- "San Joaquin snakeweed"
- ],
- "date": [
- "1880s"
- ],
- "geoLocation": [
- {
- "L1": {
- "content": "North America",
- "type": "Continent"
- },
- "L2": {
- "content": "United States",
- "type": "Country"
- },
- "L3": {
- "content": "California",
- "type": "State"
- },
- "Other": {
- "content": "Oakland Hills",
- "type": "Locality"
- }
- }
- ],
- "name": [
- "Greene, E. L."
- ],
- "online_media_type": [
- "Images"
- ],
- "place": [
- "United States",
- "California",
- "North America"
- ],
- "scientific_name": [
- "Gutierrezia californica Torr. & A. Gray"
- ],
- "tax_class": [
- "Dicotyledonae"
- ],
- "tax_family": [
- "Asteraceae"
- ],
- "tax_kingdom": [
- "Plantae"
- ],
- "tax_order": [
- "Asterales"
- ],
- "topic": [
- "Dicotyledonae"
- ]
- }
- },
- "docSignature": "18cd1319f3f8127a9420093b03e9c427bb1bb6ba_8c35721a2a75f48e3352b699bdcf833d",
- "hash": "cccaffbc7b131b0de3292350feab859f8c78c8e9",
- "id": "edanmdm-nmnhbotany_12690244",
- "lastTimeUpdated": "1581934629",
- "timestamp": "1581934690",
- "title": "Gutierrezia californica Torr. & A. Gray",
- "type": "edanmdm",
- "unitCode": "NMNHBOTANY",
- "url": "edanmdm:nmnhbotany_12690244",
- "version": ""
- }
- ]
- },
- "responseCode": 1,
- "status": 200
-}
diff --git a/tests/dags/providers/provider_api_scripts/test_smithsonian.py b/tests/dags/providers/provider_api_scripts/test_smithsonian.py
index 708430270..4509883ee 100644
--- a/tests/dags/providers/provider_api_scripts/test_smithsonian.py
+++ b/tests/dags/providers/provider_api_scripts/test_smithsonian.py
@@ -1,32 +1,21 @@
import json
-import logging
-import os
-from unittest.mock import call, patch
+from pathlib import Path
+from unittest.mock import patch
import pytest
from airflow.exceptions import AirflowException
-from common.licenses import LicenseInfo
-from providers.provider_api_scripts import smithsonian as si
+from providers.provider_api_scripts.smithsonian import SmithsonianDataIngester
-logger = logging.getLogger(__name__)
+RESOURCES = Path(__file__).parent / "resources/smithsonian"
-logging.basicConfig(
- format="%(asctime)s - %(name)s - %(levelname)s: %(message)s", level=logging.DEBUG
-)
-
-RESOURCES = os.path.join(
- os.path.abspath(os.path.dirname(__file__)), "resources/smithsonian"
-)
-
-
-def _get_resource_json(json_name):
- with open(os.path.join(RESOURCES, json_name)) as f:
- resource_json = json.load(f)
- return resource_json
+# Set up test class
+ingester = SmithsonianDataIngester()
def test_get_hash_prefixes_with_len_one():
+ with patch.object(ingester, "hash_prefix_length", 1):
+ actual_prefix_list = list(ingester._get_hash_prefixes())
expect_prefix_list = [
"0",
"1",
@@ -45,29 +34,16 @@ def test_get_hash_prefixes_with_len_one():
"e",
"f",
]
- actual_prefix_list = list(si._get_hash_prefixes(1))
assert actual_prefix_list == expect_prefix_list
def test_alert_new_unit_codes():
- unit_code_set = {"a", "b", "c", "d"}
sub_prov_dict = {"sub_prov1": {"a", "c"}, "sub_prov2": {"b"}, "sub_prov3": {"e"}}
-
- assert si.get_new_and_outdated_unit_codes(unit_code_set, sub_prov_dict) == (
- {"d"},
- {"e"},
- )
-
-
-def test_get_unit_codes_from_api_retries():
- mock_response = {"terms": []}
- # Patch the sleep function so it doesn't take long
- with patch.object(
- si.delayed_requester, "get_response_json", return_value=mock_response
- ) as request_patch, patch("time.sleep"):
- with pytest.raises(ValueError, match="No unit codes received."):
- si.get_unit_codes_from_api()
- assert request_patch.call_count == 3
+ unit_code_set = {"a", "b", "c", "d"}
+ with patch.dict(ingester.sub_providers, sub_prov_dict, clear=True):
+ actual_codes = ingester._get_new_and_outdated_unit_codes(unit_code_set)
+ expected_codes = ({"d"}, {"e"})
+ assert actual_codes == expected_codes
@pytest.mark.parametrize(
@@ -81,28 +57,26 @@ def test_get_unit_codes_from_api_retries():
def test_validate_unit_codes_from_api_raises_exception(
new_unit_codes, outdated_unit_codes
):
- with patch.object(si, "get_unit_codes_from_api"), patch.object(
- si,
- "get_new_and_outdated_unit_codes",
+ with patch.object(ingester, "_get_unit_codes_from_api"), patch.object(
+ ingester,
+ "_get_new_and_outdated_unit_codes",
return_value=(new_unit_codes, outdated_unit_codes),
):
- with pytest.raises(
- AirflowException,
- match="^\n\\*Updates needed to the SMITHSONIAN_SUB_PROVIDERS dictionary\\**",
- ):
- si.validate_unit_codes_from_api()
+ message = "^\n\\*Updates needed to the SMITHSONIAN_SUB_PROVIDERS dictionary\\**"
+ with pytest.raises(AirflowException, match=message):
+ ingester.validate_unit_codes_from_api()
def test_validate_unit_codes_from_api():
- with patch.object(si, "get_unit_codes_from_api"), patch.object(
- si, "get_new_and_outdated_unit_codes", return_value=(set(), set())
+ with patch.object(ingester, "_get_unit_codes_from_api"), patch.object(
+ ingester, "_get_new_and_outdated_unit_codes", return_value=(set(), set())
):
# Validation should run without raising an exception
- si.validate_unit_codes_from_api()
+ ingester.validate_unit_codes_from_api()
@pytest.mark.parametrize(
- "input_int,expect_len,expect_first,expect_last",
+ "input_int, expect_len, expect_first, expect_last",
[
(1, 16, "0", "f"),
(2, 256, "00", "ff"),
@@ -113,7 +87,9 @@ def test_validate_unit_codes_from_api():
def test_get_hash_prefixes_with_other_len(
input_int, expect_len, expect_first, expect_last
):
- actual_list = list(si._get_hash_prefixes(input_int))
+ with patch.object(ingester, "hash_prefix_length", input_int):
+ actual_list = list(ingester._get_hash_prefixes())
+
assert all("0x" not in h for h in actual_list)
assert all(
int(actual_list[i + 1], 16) - int(actual_list[i], 16) == 1
@@ -124,212 +100,162 @@ def test_get_hash_prefixes_with_other_len(
assert actual_list[-1] == expect_last
-def test_process_hash_prefix_with_none_response_json():
- endpoint = "https://abc.com/123"
- limit = 100
- hash_prefix = "00"
- retries = 3
- qp = {"q": "abc"}
-
- patch_get_response_json = patch.object(
- si.delayed_requester, "get_response_json", return_value=None
- )
- patch_build_qp = patch.object(si, "_build_query_params", return_value=qp)
- patch_process_response = patch.object(si, "_process_response_json")
- with patch_get_response_json as mock_get_response_json, patch_build_qp as mock_build_qp, patch_process_response as mock_process_response:
- si._process_hash_prefix(
- hash_prefix, endpoint=endpoint, limit=limit, retries=retries
- )
- mock_process_response.assert_not_called()
- mock_build_qp.assert_called_once_with(0, hash_prefix=hash_prefix)
- mock_get_response_json.assert_called_once_with(
- endpoint, retries=retries, query_params=qp
- )
-
-
-def test_process_hash_prefix_with_response_json_no_row_count():
- endpoint = "https://abc.com/123"
- limit = 100
- hash_prefix = "00"
- retries = 3
- qp = {"q": "abc"}
- response_json = {"abc": "123"}
-
- patch_get_response_json = patch.object(
- si.delayed_requester, "get_response_json", return_value=response_json
- )
- patch_build_qp = patch.object(si, "_build_query_params", return_value=qp)
- patch_process_response = patch.object(si, "_process_response_json")
- with patch_get_response_json as mock_get_response_json, patch_build_qp as mock_build_qp, patch_process_response as mock_process_response:
- si._process_hash_prefix(
- hash_prefix, endpoint=endpoint, limit=limit, retries=retries
- )
- mock_process_response.assert_called_with(response_json)
- mock_build_qp.assert_called_once_with(0, hash_prefix=hash_prefix)
- mock_get_response_json.assert_called_once_with(
- endpoint, retries=retries, query_params=qp
- )
-
-
-def test_process_hash_prefix_with_good_response_json():
- endpoint = "https://abc.com/123"
- limit = 100
- hash_prefix = "00"
- retries = 3
- qp = {"q": "abc"}
- response_json = {"response": {"abc": "123", "rowCount": 150}}
-
- patch_get_response_json = patch.object(
- si.delayed_requester, "get_response_json", return_value=response_json
+def test_get_next_query_params_first_call():
+ hash_prefix = "ff"
+ actual_params = ingester.get_next_query_params(
+ prev_query_params=None, hash_prefix=hash_prefix
)
- patch_build_qp = patch.object(si, "_build_query_params", return_value=qp)
- patch_process_response = patch.object(si, "_process_response_json", return_value=0)
- with patch_build_qp as mock_build_qp, patch_get_response_json as mock_get_response_json, patch_process_response as mock_process_response:
- si._process_hash_prefix(
- hash_prefix, endpoint=endpoint, limit=limit, retries=retries
- )
- expect_process_response_calls = [call(response_json), call(response_json)]
- expect_build_qp_calls = [
- call(0, hash_prefix=hash_prefix),
- call(limit, hash_prefix=hash_prefix),
- ]
- expect_get_response_json_calls = [
- call(endpoint, retries=retries, query_params=qp),
- call(endpoint, retries=retries, query_params=qp),
- ]
- mock_build_qp.assert_has_calls(expect_build_qp_calls)
- mock_get_response_json.assert_has_calls(expect_get_response_json_calls)
- mock_process_response.assert_has_calls(expect_process_response_calls)
+ actual_params.pop("api_key") # Omitting the API key
+ expected_params = {
+ "q": f"online_media_type:Images AND media_usage:CC0 AND hash:{hash_prefix}*",
+ "start": 0,
+ "rows": 1000,
+ }
+ assert actual_params == expected_params
-def test_build_query_params():
- hash_prefix = "ff"
- row_offset = 10
- default_params = {"api_key": "pass123", "rows": 10}
- acutal_params = si._build_query_params(
- row_offset, hash_prefix=hash_prefix, default_params=default_params
- )
- expect_params = {
+def test_get_next_query_params_updates_parameters():
+ previous_query_params = {
"api_key": "pass123",
- "rows": 10,
- "q": (
- f"online_media_type:Images AND media_usage:CC0 " f"AND hash:{hash_prefix}*"
- ),
- "start": row_offset,
+ "q": "online_media_type:Images AND media_usage:CC0 AND hash:ff*",
+ "start": 0,
+ "rows": 1000,
}
- assert acutal_params == expect_params
- assert default_params == {"api_key": "pass123", "rows": 10}
-
-
-def test_process_response_json_with_no_rows_json():
- response_json = {
- "status": 200,
- "responseCode": 1,
- "response": {
- "norows": ["abc", "def"],
- "rowCount": 2,
- "message": "content found",
- },
+ actual_params = ingester.get_next_query_params(previous_query_params)
+ expected_params = {
+ "api_key": "pass123",
+ "q": "online_media_type:Images AND media_usage:CC0 AND hash:ff*",
+ "start": 1000,
+ "rows": 1000,
}
- patch_process_image_list = patch.object(si, "_process_image_list", return_value=2)
-
- with patch_process_image_list as mock_process_image_list:
- si._process_response_json(response_json)
-
- mock_process_image_list.assert_not_called()
-
-
-def test_process_response_json_uses_required_getters():
- """
- This test only checks for appropriate calls to getter functions
- """
- response_json = {"test key": "test value"}
- row_list = ["row0", "row1"]
- image_lists = [["image", "list", "zero"], ["image", "list", "one"]]
- flu_list = ["flu0", "flu1"]
- title_list = ["title0", "title1"]
- creator_list = ["creator0", "creator1"]
- metadata_list = ["metadata0", "metadata1"]
- tags_list = ["tags0", "tags1"]
- source_list = ["source0", "source1"]
-
- get_row_list = patch.object(si, "_get_row_list", return_value=row_list)
- process_image_list = patch.object(si, "_process_image_list", return_value=2)
- get_image_list = patch.object(si, "_get_image_list", side_effect=image_lists)
- get_flu = patch.object(si, "_get_foreign_landing_url", side_effect=flu_list)
- get_title = patch.object(si, "_get_title", side_effect=title_list)
- get_creator = patch.object(si, "_get_creator", side_effect=creator_list)
- ext_meta_data = patch.object(si, "_extract_meta_data", side_effect=metadata_list)
- ext_tags = patch.object(si, "_extract_tags", side_effect=tags_list)
- ext_source = patch.object(si, "_extract_source", side_effect=source_list)
-
- with get_row_list as mock_get_row_list, get_image_list as mock_get_image_list, get_flu as mock_get_foreign_landing_url, get_title as mock_get_title, get_creator as mock_get_creator, ext_meta_data as mock_extract_meta_data, ext_tags as mock_extract_tags, ext_source as mock_extract_source, process_image_list as mock_process_image_list:
- si._process_response_json(response_json)
-
- getter_calls_list = [call(r) for r in row_list]
- image_processing_call_list = [
- call(
- image_lists[0],
- flu_list[0],
- title_list[0],
- creator_list[0],
- metadata_list[0],
- tags_list[0],
- source_list[0],
+ assert actual_params == expected_params
+
+
+ "input_row, field, expected_dict",
+ [
+ # field: descriptiveNonRepeating
+ ({}, "descriptiveNonRepeating", {}),
+ ({"content": {"key": {"key2", "val2"}}}, "descriptiveNonRepeating", {}),
+ (
+ {"noncontent": {"descriptiveNonRepeating": {"key2": "val2"}}},
+ "descriptiveNonRepeating",
+ {},
),
- call(
- image_lists[1],
- flu_list[1],
- title_list[1],
- creator_list[1],
- metadata_list[1],
- tags_list[1],
- source_list[1],
+ (
+ {"content": {"descriptiveNonRepeating": {"key2": "val2"}}},
+ "descriptiveNonRepeating",
+ {"key2": "val2"},
),
- ]
- mock_get_row_list.assert_called_once_with(response_json)
- assert mock_process_image_list.mock_calls == image_processing_call_list
- assert mock_get_image_list.mock_calls == getter_calls_list
- assert mock_get_foreign_landing_url.mock_calls == getter_calls_list
- assert mock_get_title.mock_calls == getter_calls_list
- assert mock_get_creator.mock_calls == getter_calls_list
- assert mock_extract_meta_data.mock_calls == getter_calls_list
- assert mock_extract_tags.mock_calls == getter_calls_list
- assert mock_extract_source.mock_calls == [call(m) for m in metadata_list]
+ # field: indexedStructured
+ ({}, "indexedStructured", {}),
+ ({"content": {"key": {"key2", "val2"}}}, "indexedStructured", {}),
+ (
+ {"noncontent": {"indexedStructured": {"key2": "val2"}}},
+ "indexedStructured",
+ {},
+ ),
+ (
+ {"content": {"indexedStructured": {"key2": "val2"}}},
+ "indexedStructured",
+ {"key2": "val2"},
+ ),
+ # field: freetext
+ ({}, "freetext", {}),
+ ({"content": {"key": {"key2", "val2"}}}, "freetext", {}),
+ ({"noncontent": {"freetext": {"key2": "val2"}}}, "freetext", {}),
+ ({"content": {"freetext": {"key2": "val2"}}}, "freetext", {"key2": "val2"}),
+ ],
+)
+def test_content_dict(input_row, field, expected_dict):
+ actual_dict = ingester._get_content_dict(input_row, field)
+ assert actual_dict == expected_dict
-def test_get_row_list_with_no_rows():
- response_json = {"not": "rows"}
- row_list = si._get_row_list(response_json)
- assert row_list == []
+ "required_type,default_input",
+ [
+ (str, ""),
+ (int, 0),
+ (float, 0.0),
+ (complex, 0j),
+ (list, []),
+ (tuple, ()),
+ (dict, {}),
+ (set, set()),
+ (bool, False),
+ (bytes, b""),
+ ],
+)
+def test_check_type_with_defaults(required_type, default_input):
+ assert ingester._check_type(default_input, required_type) == default_input
@pytest.mark.parametrize(
- "input_row_list,expect_row_list",
+ "required_type,good_input",
[
- ([], []),
- ("abc", []), # wrong type
- ({"key": "val"}, []), # wrong type
- ([{"key", "val"}], [{"key", "val"}]), # nested dict
- ([{"key1", "val1"}, "abc"], [{"key1", "val1"}, "abc"]),
+ (str, "abc"),
+ (int, 5),
+ (float, 1.2),
+ (complex, 3 + 2j),
+ (list, ["a", 2, 0, False]),
+ (tuple, (1, 0, False)),
+ (dict, {"key": "val", "f": False}),
+ (set, {1, False, "abc"}),
+ (bool, True),
+ (bytes, b"abc"),
],
)
-def test_get_row_list(input_row_list, expect_row_list):
- response_json = {
- "status": 200,
- "responseCode": 1,
- "response": {
- "rows": input_row_list,
- "rowCount": 734,
- "message": "content found",
- },
- }
- actual_row_list = si._get_row_list(response_json)
- assert actual_row_list == expect_row_list
+def test_check_type_with_truthy_good_inputs(required_type, good_input):
+ assert ingester._check_type(good_input, required_type) == good_input
@pytest.mark.parametrize(
- "input_dnr,expect_image_list",
+ "required_type,good_indices,default",
+ [
+ (str, (0, 1), ""),
+ (int, (2, 3), 0),
+ (float, (4, 5), 0.0),
+ (complex, (6, 7), 0j),
+ (list, (8, 9), []),
+ (tuple, (10, 11), ()),
+ (dict, (12, 13), {}),
+ (set, (14, 15), set()),
+ (bool, (16, 17), False),
+ (bytes, (18, 19), b""),
+ ],
+)
+def test_check_type_with_bad_inputs(required_type, good_indices, default):
+ bad_input_list = [
+ "abc",
+ "",
+ 5,
+ 0,
+ 1.2,
+ 0.0,
+ 3 + 2j,
+ 0j,
+ ["a", 2],
+ [],
+ (1, 2),
+ (),
+ {"key": "val"},
+ {},
+ {1, "abc"},
+ set(),
+ True,
+ False,
+ b"abc",
+ b"",
+ ]
+ for i in sorted(good_indices, reverse=True):
+ del bad_input_list[i]
+ for bad_input in bad_input_list:
+ assert ingester._check_type(bad_input, required_type) == default
+
+
+ "input_dnr, expect_image_list",
[
({}, []),
({"non_media": {"media": ["image1", "image2"]}}, []),
@@ -349,15 +275,20 @@ def test_get_row_list(input_row_list, expect_row_list):
def test_get_image_list(input_dnr, expect_image_list):
input_row = {"key": "val"}
with patch.object(
- si, "_get_descriptive_non_repeating_dict", return_value=input_dnr
+ ingester, "_get_content_dict", return_value=input_dnr
) as mock_dnr:
- actual_image_list = si._get_image_list(input_row)
- mock_dnr.assert_called_once_with(input_row)
+ actual_image_list = ingester._get_image_list(input_row)
+ mock_dnr.assert_called_once_with(input_row, "descriptiveNonRepeating")
assert actual_image_list == expect_image_list
+def test_get_media_type():
+ actual_type = ingester.get_media_type(record={})
+ assert actual_type == "image"
+
+
@pytest.mark.parametrize(
- "input_dnr,expect_foreign_landing_url",
+ "input_dnr, expect_foreign_landing_url",
[
({}, None),
(
@@ -375,29 +306,15 @@ def test_get_image_list(input_dnr, expect_image_list):
def test_get_foreign_landing_url(input_dnr, expect_foreign_landing_url):
input_row = {"key": "val"}
with patch.object(
- si, "_get_descriptive_non_repeating_dict", return_value=input_dnr
+ ingester, "_get_content_dict", return_value=input_dnr
) as mock_dnr:
- actual_foreign_landing_url = si._get_foreign_landing_url(input_row)
- mock_dnr.assert_called_once_with(input_row)
+ actual_foreign_landing_url = ingester._get_foreign_landing_url(input_row)
+ mock_dnr.assert_called_once_with(input_row, "descriptiveNonRepeating")
assert actual_foreign_landing_url == expect_foreign_landing_url
@pytest.mark.parametrize(
- "input_row,expect_title",
- [
- ({}, None),
- ({"id": "abcde"}, None),
- ({"title": "my Title"}, "my Title"),
- ({"id": "abcde", "title": "my Title"}, "my Title"),
- ],
-)
-def test_get_title(input_row, expect_title):
- actual_title = si._get_title(input_row)
- assert actual_title == expect_title
-
-
- "input_is,input_ft,expect_creator",
+ "input_is, input_ft, expected_creator",
[
({}, {}, None),
({"name": ["Alice"]}, {}, None),
@@ -489,21 +406,20 @@ def test_get_title(input_row, expect_title):
),
],
)
-def test_get_creator(input_is, input_ft, expect_creator):
+def test_get_creator(input_is, input_ft, expected_creator):
creator_types = {"creator": 0, "designer": 1, "after": 3}
- input_row = {"test": "row"}
- get_is = patch.object(si, "_get_indexed_structured_dict", return_value=input_is)
- get_ft = patch.object(si, "_get_freetext_dict", return_value=input_ft)
- with get_is as mock_is, get_ft as mock_ft:
- actual_creator = si._get_creator(input_row, creator_types=creator_types)
+ input_row = {
+ "test": "row",
+ "content": {"freetext": input_ft, "indexedStructured": input_is},
+ }
+ with patch.object(ingester, "creator_types", creator_types):
+ actual_creator = ingester._get_creator(input_row)
- mock_is.assert_called_once_with(input_row)
- mock_ft.assert_called_once_with(input_row)
- assert actual_creator == expect_creator
+ assert actual_creator == expected_creator
@pytest.mark.parametrize(
- "input_ft,input_dnr,expect_description",
+ "input_ft, input_dnr, expected_description",
[
({}, {}, None),
({"notes": [{"label": "notthis", "content": "blah"}]}, {}, None),
@@ -533,25 +449,21 @@ def test_get_creator(input_is, input_ft, expect_creator):
),
],
)
-def test_ext_meta_data_description(input_ft, input_dnr, expect_description):
+def test_ext_meta_data_description(input_ft, input_dnr, expected_description):
description_types = {"description", "summary"}
- input_row = {"test": "row"}
- get_dnr = patch.object(
- si, "_get_descriptive_non_repeating_dict", return_value=input_dnr
- )
- get_ft = patch.object(si, "_get_freetext_dict", return_value=input_ft)
- with get_dnr as mock_dnr, get_ft as mock_ft:
- meta_data = si._extract_meta_data(
- input_row, description_types=description_types
- )
+ input_row = {
+ "test": "row",
+ "content": {"freetext": input_ft, "descriptiveNonRepeating": input_dnr},
+ }
+ with patch.object(ingester, "description_types", description_types):
+ meta_data = ingester._extract_meta_data(input_row)
actual_description = meta_data.get("description")
- mock_dnr.assert_called_once_with(input_row)
- mock_ft.assert_called_once_with(input_row)
- assert actual_description == expect_description
+
+ assert actual_description == expected_description
@pytest.mark.parametrize(
- "input_ft,input_dnr,expect_label_text",
+ "input_ft, input_dnr, expected_label_text",
[
({}, {}, None),
({"notes": [{"label": "notthis", "content": "blah"}]}, {}, None),
@@ -570,22 +482,19 @@ def test_ext_meta_data_description(input_ft, input_dnr, expect_description):
),
],
)
-def test_ext_meta_data_label_text(input_ft, input_dnr, expect_label_text):
- input_row = {"test": "row"}
- get_dnr = patch.object(
- si, "_get_descriptive_non_repeating_dict", return_value=input_dnr
- )
- get_ft = patch.object(si, "_get_freetext_dict", return_value=input_ft)
- with get_dnr as mock_dnr, get_ft as mock_ft:
- meta_data = si._extract_meta_data(input_row)
+def test_ext_meta_data_label_text(input_ft, input_dnr, expected_label_text):
+ input_row = {
+ "test": "row",
+ "content": {"freetext": input_ft, "descriptiveNonRepeating": input_dnr},
+ }
+ meta_data = ingester._extract_meta_data(input_row)
actual_label_text = meta_data.get("label_text")
- mock_dnr.assert_called_once_with(input_row)
- mock_ft.assert_called_once_with(input_row)
- assert actual_label_text == expect_label_text
+
+ assert actual_label_text == expected_label_text
@pytest.mark.parametrize(
- "input_ft,input_dnr,expect_meta_data",
+ "input_ft, input_dnr, expected_meta_data",
[
({"nothing": "here"}, {"nothing_to": "see"}, {}),
({}, {"unit_code": "SIA"}, {"unit_code": "SIA"}),
@@ -596,21 +505,18 @@ def test_ext_meta_data_label_text(input_ft, input_dnr, expect_label_text):
),
],
)
-def test_extract_meta_data_dnr_fields(input_ft, input_dnr, expect_meta_data):
- input_row = {"test": "row"}
- get_dnr = patch.object(
- si, "_get_descriptive_non_repeating_dict", return_value=input_dnr
- )
- get_ft = patch.object(si, "_get_freetext_dict", return_value=input_ft)
- with get_dnr as mock_dnr, get_ft as mock_ft:
- actual_meta_data = si._extract_meta_data(input_row)
- mock_dnr.assert_called_once_with(input_row)
- mock_ft.assert_called_once_with(input_row)
- assert actual_meta_data == expect_meta_data
+def test_extract_meta_data_dnr_fields(input_ft, input_dnr, expected_meta_data):
+ input_row = {
+ "test": "row",
+ "content": {"freetext": input_ft, "descriptiveNonRepeating": input_dnr},
+ }
+ actual_meta_data = ingester._extract_meta_data(input_row)
+
+ assert actual_meta_data == expected_meta_data
@pytest.mark.parametrize(
- "input_is,expect_tags",
+ "input_is, expect_tags",
[
({}, []),
({"nothing": "here"}, []),
@@ -641,139 +547,15 @@ def test_extract_meta_data_dnr_fields(input_ft, input_dnr, expect_meta_data):
)
def test_extract_tags(input_is, expect_tags):
input_row = {"test": "row"}
- get_is = patch.object(si, "_get_indexed_structured_dict", return_value=input_is)
+ get_is = patch.object(ingester, "_get_content_dict", return_value=input_is)
with get_is as mock_is:
- actual_tags = si._extract_tags(input_row)
- mock_is.assert_called_once_with(input_row)
+ actual_tags = ingester._extract_tags(input_row)
+ mock_is.assert_called_once_with(input_row, "indexedStructured")
assert actual_tags == expect_tags
@pytest.mark.parametrize(
- "input_row,expect_dnr_dict",
- [
- ({}, {}),
- ({"content": {"key": {"key2", "val2"}}}, {}),
- ({"noncontent": {"descriptiveNonRepeating": {"key2": "val2"}}}, {}),
- ({"content": {"descriptiveNonRepeating": {"key2": "val2"}}}, {"key2": "val2"}),
- ],
-)
-def test_get_descriptive_non_repeating_dict(input_row, expect_dnr_dict):
- actual_dnr_dict = si._get_descriptive_non_repeating_dict(input_row)
- assert actual_dnr_dict == expect_dnr_dict
-
-
- "input_row,expect_ind_struc_dict",
- [
- ({}, {}),
- ({"content": {"key": {"key2", "val2"}}}, {}),
- ({"noncontent": {"indexedStructured": {"key2": "val2"}}}, {}),
- ({"content": {"indexedStructured": {"key2": "val2"}}}, {"key2": "val2"}),
- ],
-)
-def test_get_indexed_structured_dict(input_row, expect_ind_struc_dict):
- actual_ind_struc_dict = si._get_indexed_structured_dict(input_row)
- assert actual_ind_struc_dict == expect_ind_struc_dict
-
-
- "input_row,expect_freetext_dict",
- [
- ({}, {}),
- ({"content": {"key": {"key2", "val2"}}}, {}),
- ({"noncontent": {"freetext": {"key2": "val2"}}}, {}),
- ({"content": {"freetext": {"key2": "val2"}}}, {"key2": "val2"}),
- ],
-)
-def test_get_freetext_dict(input_row, expect_freetext_dict):
- actual_freetext_dict = si._get_freetext_dict(input_row)
- assert actual_freetext_dict == expect_freetext_dict
-
-
- "required_type,default_input",
- [
- (str, ""),
- (int, 0),
- (float, 0.0),
- (complex, 0j),
- (list, []),
- (tuple, ()),
- (dict, {}),
- (set, set()),
- (bool, False),
- (bytes, b""),
- ],
-)
-def test_check_type_with_defaults(required_type, default_input):
- assert si._check_type(default_input, required_type) == default_input
-
-
- "required_type,good_input",
- [
- (str, "abc"),
- (int, 5),
- (float, 1.2),
- (complex, 3 + 2j),
- (list, ["a", 2, 0, False]),
- (tuple, (1, 0, False)),
- (dict, {"key": "val", "f": False}),
- (set, {1, False, "abc"}),
- (bool, True),
- (bytes, b"abc"),
- ],
-)
-def test_check_type_with_truthy_good_inputs(required_type, good_input):
- assert si._check_type(good_input, required_type) == good_input
-
-
- "required_type,good_indices,default",
- [
- (str, (0, 1), ""),
- (int, (2, 3), 0),
- (float, (4, 5), 0.0),
- (complex, (6, 7), 0j),
- (list, (8, 9), []),
- (tuple, (10, 11), ()),
- (dict, (12, 13), {}),
- (set, (14, 15), set()),
- (bool, (16, 17), False),
- (bytes, (18, 19), b""),
- ],
-)
-def test_check_type_with_bad_inputs(required_type, good_indices, default):
- bad_input_list = [
- "abc",
- "",
- 5,
- 0,
- 1.2,
- 0.0,
- 3 + 2j,
- 0j,
- ["a", 2],
- [],
- (1, 2),
- (),
- {"key": "val"},
- {},
- {1, "abc"},
- set(),
- True,
- False,
- b"abc",
- b"",
- ]
- for i in sorted(good_indices, reverse=True):
- del bad_input_list[i]
- for bad_input in bad_input_list:
- assert si._check_type(bad_input, required_type) == default
-
-
- "input_media,expect_calls",
+ "input_media, expected_image_data",
[
([], []),
(
@@ -795,163 +577,61 @@ def test_check_type_with_bad_inputs(required_type, good_indices, default):
"content": "https://image.url.two",
},
],
- [
- call(
- foreign_landing_url="https://foreignlanding.url",
- image_url="https://image.url.one",
- license_info=LicenseInfo(
- "cc0",
- "1.0",
- "https://creativecommons.org/publicdomain/zero/1.0/",
- "https://license.url",
- ),
- foreign_identifier="id_one",
- title="The Title",
- creator="Alice",
- meta_data={"unit_code": "NMNHBOTANY"},
- raw_tags=["tag", "list"],
- source="smithsonian_national_museum_of_natural_history",
- ),
- call(
- foreign_landing_url="https://foreignlanding.url",
- image_url="https://image.url.two",
- license_info=LicenseInfo(
- "cc0",
- "1.0",
- "https://creativecommons.org/publicdomain/zero/1.0/",
- "https://license.url",
- ),
- foreign_identifier="id_two",
- title="The Title",
- creator="Alice",
- meta_data={"unit_code": "NMNHBOTANY"},
- raw_tags=["tag", "list"],
- source="smithsonian_national_museum_of_natural_history",
- ),
- ],
- ),
- (
[
{
- "thumbnail": "https://thumbnail.one",
- "idsId": "id_one",
- "usage": {"access": "CC-BY"},
- "guid": "http://gu.id.one",
- "type": "Images",
- "content": "https://image.url.one",
+ "foreign_identifier": "id_one",
+ "image_url": "https://image.url.one",
},
{
- "thumbnail": "https://thumbnail.two",
- "idsId": "id_two",
- "usage": {"access": "CC0"},
- "guid": "http://gu.id.two",
- "type": "Images",
- "content": "https://image.url.two",
+ "foreign_identifier": "id_two",
+ "image_url": "https://image.url.two",
},
],
- [
- call(
- foreign_landing_url="https://foreignlanding.url",
- image_url="https://image.url.two",
- license_info=LicenseInfo(
- "cc0",
- "1.0",
- "https://creativecommons.org/publicdomain/zero/1.0/",
- "https://license.url",
- ),
- foreign_identifier="id_two",
- title="The Title",
- creator="Alice",
- meta_data={"unit_code": "NMNHBOTANY"},
- raw_tags=["tag", "list"],
- source="smithsonian_national_museum_of_natural_history",
- )
- ],
- ),
- (
- [
- {
- "thumbnail": "https://thumbnail.one",
- "idsId": "id_one",
- "usage": {"access": "CC0"},
- "guid": "http://gu.id.one",
- "type": "Images",
- "content": "https://image.url.one",
- },
- {
- "thumbnail": "https://thumbnail.two",
- "idsId": "id_two",
- "usage": {"access": "CC0"},
- "guid": "http://gu.id.two",
- "type": "Audio",
- "content": "https://image.url.two",
- },
- ],
- [
- call(
- foreign_landing_url="https://foreignlanding.url",
- image_url="https://image.url.one",
- license_info=LicenseInfo(
- "cc0",
- "1.0",
- "https://creativecommons.org/publicdomain/zero/1.0/",
- "https://license.url",
- ),
- foreign_identifier="id_one",
- title="The Title",
- creator="Alice",
- meta_data={"unit_code": "NMNHBOTANY"},
- raw_tags=["tag", "list"],
- source="smithsonian_national_museum_of_natural_history",
- )
- ],
),
],
)
-def test_process_image_list(input_media, expect_calls):
- with patch.object(si.image_store, "add_item", return_value=10) as mock_add_item:
- si._process_image_list(
- input_media,
- foreign_landing_url="https://foreignlanding.url",
- title="The Title",
- creator="Alice",
- meta_data={"unit_code": "NMNHBOTANY"},
- tags=["tag", "list"],
- source="smithsonian_national_museum_of_natural_history",
- license_url="https://license.url",
- )
- assert expect_calls == mock_add_item.mock_calls
-
-
-def test_process_image_data_with_sub_provider():
- response = _get_resource_json("sub_provider_example.json")
- with patch.object(si.image_store, "add_item", return_value=100) as mock_add_item:
- total_images = si._process_response_json(response)
-
- expect_meta_data = {
- "unit_code": "SIA",
- "data_source": "Smithsonian Institution Archives",
+def test_process_image_list(input_media, expected_image_data):
+ shared_image_data = {
+ "foreign_landing_url": "https://foreignlanding.url",
+ "title": "The Title",
+ "license_info": ingester.license_info,
+ "creator": "Alice",
+ "meta_data": {"unit_code": "NMNHBOTANY"},
+ "source": "smithsonian_national_museum_of_natural_history",
+ "raw_tags": ["tag", "list"],
}
+ expected_result = [(img | shared_image_data) for img in expected_image_data]
+ actual_image_data = ingester._get_associated_images(input_media, shared_image_data)
+ assert actual_image_data == expected_result
+
+
+def test_get_record_data():
+ with open(RESOURCES / "actual_record_data.json") as f:
+ data = json.load(f)
+ actual_data = ingester.get_record_data(data)
+ expected_data = [
+ {
+ "image_url": "https://collections.nmnh.si.edu/media/?irn=15814382",
+ "foreign_identifier": "https://collections.nmnh.si.edu/media/?irn=15814382",
+ "foreign_landing_url": "http://n2t.net/ark:/65665/34857ca78-9195-4156-849b-1ec47f7cd1ce",
+ "title": "Passerculus sandwichensis nevadensis",
+ "license_info": ingester.license_info,
+ "source": "smithsonian_national_museum_of_natural_history",
+ "creator": "Seymour H. Levy",
+ "meta_data": {
+ "unit_code": "NMNHBIRDS",
+ "data_source": "NMNH - Vertebrate Zoology - Birds Division",
+ },
+ "raw_tags": [
+ "1950s",
+ "Animals",
+ "Birds",
+ "United States",
+ "Pinal",
+ "North America",
+ "Arizona",
+ ],
+ }
+ ]
- mock_add_item.assert_called_once_with(
- foreign_landing_url=None,
- image_url="https://ids.si.edu/ids/deliveryService?id=SIA-SIA2010-2358",
- license_info=(
- LicenseInfo(
- "cc0",
- "1.0",
- "https://creativecommons.org/publicdomain/zero/1.0/",
- "https://creativecommons.org/publicdomain/zero/1.0/",
- )
- ),
- foreign_identifier="SIA-SIA2010-2358",
- creator="Gruber, Martin A",
- title=(
- "Views of the National Zoological Park in Washington, DC, "
- "showing Elephant"
- ),
- meta_data=expect_meta_data,
- raw_tags=["1920s", "1910s", "Archival materials", "Photographs", "Animals"],
- source="smithsonian_institution_archives",
- )
- assert total_images == 100
+ assert actual_data == expected_data