diff --git a/archive_api/service/common.py b/archive_api/service/common.py index 2119d716..d7a71be8 100644 --- a/archive_api/service/common.py +++ b/archive_api/service/common.py @@ -11,3 +11,4 @@ def __init__(self, msg: str, service: int): super().__init__(f"Service Account {service}: {msg}") +FUNDER_DOE_BER = "U.S. DOE > Office of Science > Biological and Environmental Research (BER)" diff --git a/archive_api/service/essdive_transfer/crosswalk.py b/archive_api/service/essdive_transfer/crosswalk.py index fc269391..cb7d5a3b 100644 --- a/archive_api/service/essdive_transfer/crosswalk.py +++ b/archive_api/service/essdive_transfer/crosswalk.py @@ -8,10 +8,12 @@ import re from io import StringIO -from typing import Dict, IO, List, Optional, TextIO, Tuple, Union +from typing import Dict, List, Optional, TextIO, Tuple, Union import logging +from service.common import FUNDER_DOE_BER + # NGEE-Tropics Project information LOCATION_NOT_APPLICABLE = "N/A" LOCATION_RF_KEYWORD = "ESS-DIVE Location Metadata Reporting Format" @@ -30,7 +32,7 @@ JSONLD_LICENSE = "http://creativecommons.org/licenses/by/4.0/" # Funding Organization -JSONLD_FUNDER = {"name": "U.S. DOE > Office of Science > Biological and Environmental Research (BER)"} +JSONLD_FUNDER = {"name": FUNDER_DOE_BER} DESCRIPTION_MIRROR_FORMAT = "This dataset was originally published on the NGEE Tropics Archive and is " \ "being mirrored on ESS-DIVE for long-term archival" diff --git a/archive_api/service/osti.py b/archive_api/service/osti.py index c16db0c6..122cfa76 100644 --- a/archive_api/service/osti.py +++ b/archive_api/service/osti.py @@ -9,14 +9,14 @@ import archive_api from archive_api.models import DataSet, Author, ServiceAccount -from archive_api.service.common import ServiceAccountException +from archive_api.service.common import ServiceAccountException, FUNDER_DOE_BER MAPPING = [('title', 'name', ""), ('contract_nos', 'doe_funding_contract_numbers', "None"), ('non-doe_contract_nos', 'doe_funding_contract_numbers', ""), ('originating_research_org', 'originating_institution', ""), ('description', 'description', ""), - ('sponsor_org', 'funding_organizations', ""), + ('sponsor_org', 'funding_organizations', FUNDER_DOE_BER), ('related_resource', 'reference', "")] diff --git a/archive_api/tests/test_osti.py b/archive_api/tests/test_osti.py index d4ee0fec..eb2d037f 100644 --- a/archive_api/tests/test_osti.py +++ b/archive_api/tests/test_osti.py @@ -10,7 +10,7 @@ OSTI_XML = 'Data Set 3NoneQui illud verear persequeris te. Vis probo nihil verear an, zril tamquam philosophia eos te, quo ne fugit movet contentiones. Quas mucius detraxit vis an, vero omnesque petentium sit ea. Id ius inimicus comprehensam.A few funding organizations for my selfNGT00028343947https://ngt-data.lbl.gov/dois/NGT00022016SMNGEE Tropics Archive Team, Support OrganizationNGEE Tropics Archive Test <ngeet-team@testserver>Lawrence Berkeley National LabNGEE-TRPCngt54 ENVIRONMENTAL SCIENCESEnglishUSLukeCagelcage@foobar.bazPOWER' -OSTI_XML_DUMMY = '<contract_nos>None</contract_nos><non-doe_contract_nos /><originating_research_org /><description /><sponsor_org /><related_resource /><product_nos /><set_reserved /><dataset_type>SM</dataset_type><contact_name>NGEE Tropics Archive Team, Support Organization</contact_name><contact_email>NGEE Tropics Archive Test <ngeet-team@testserver></contact_email><contact_org>Lawrence Berkeley National Lab</contact_org><site_code>NGEE-TRPC</site_code><doi_infix>ngt</doi_infix><subject_categories_code>54 ENVIRONMENTAL SCIENCES</subject_categories_code><language>English</language><country>US</country></record></records>' +OSTI_XML_DUMMY = '<records><record><title /><contract_nos>None</contract_nos><non-doe_contract_nos /><originating_research_org /><description /><sponsor_org>U.S. DOE > Office of Science > Biological and Environmental Research (BER)</sponsor_org><related_resource /><product_nos /><set_reserved /><dataset_type>SM</dataset_type><contact_name>NGEE Tropics Archive Team, Support Organization</contact_name><contact_email>NGEE Tropics Archive Test <ngeet-team@testserver></contact_email><contact_org>Lawrence Berkeley National Lab</contact_org><site_code>NGEE-TRPC</site_code><doi_infix>ngt</doi_infix><subject_categories_code>54 ENVIRONMENTAL SCIENCES</subject_categories_code><language>English</language><country>US</country></record></records>' BASEPATH = os.path.dirname(__file__)